Skip to content

Nihal009/naukri_next_backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django API Setup and Running Guide

Introduction

This guide provides comprehensive instructions for setting up and running the Django API for our project. Follow these steps meticulously to ensure proper configuration and operation of the API on your local environment.

Prerequisites

  • Python 3.10+: Ensure Python version 3.10 or higher is installed. If not, download and install it from Python's official website.
  • Git: Verify Git is installed for cloning the repository. Download Git from Git's official website.
  • Virtual Environment: Basic knowledge of virtual environment creation and management is assumed.

Cloning the Repository

  1. Open your terminal or command prompt.

  2. Clone the repository with the following command:

    git clone https://github.com/your_username/your_repository.git

    Replace https://github.com/your_username/your_repository.git with the URL of your GitHub repository.

  3. Change to the project directory:

    cd your_project_directory

    Replace your_project_directory with the name of your cloned project directory.

Setting Up the Virtual Environment

  1. Create a Virtual Environment

    To isolate the project dependencies, create a virtual environment by executing:

    python -m venv venv

    This command generates a virtual environment named venv.

  2. Activate the Virtual Environment

    • Windows

      venv\Scripts\activate
    • macOS/Linux

      source venv/bin/activate
  3. Install Dependencies

    With the virtual environment activated, install the required project dependencies:

    pip install -r requirements.txt

Environment Variables (Not neccessary for this project)

  1. Create a .env File

    In the root directory of the project, create a file named .env and add the necessary environment variables. Example content includes:

    DEBUG=True
    SECRET_KEY=your_secret_key
    DATABASE_URL=your_database_url

    Ensure you replace your_secret_key and your_database_url with appropriate values.

Running Migrations

Execute the following commands to configure the database schema:

  1. Make Migrations

    python manage.py makemigrations
  2. Apply Migrations

    python manage.py migrate

Running the Development Server

Start the Django development server with:

python manage.py runserver

This will launch the server and you should see output indicating it is running on http://127.0.0.1:8000/.

Testing the API

  1. Access the API

    Open a web browser or API client (e.g., Postman) and navigate to http://127.0.0.1:8000/ to view the available API endpoints.

  2. Explore Endpoints

    Use Django’s default web interface or API documentation to explore the endpoints.

Stopping the Server

To halt the Django development server, return to your terminal and press Ctrl+C.

Updating the Project

To synchronize with the latest changes from the repository:

  1. Pull Latest Changes

    git pull origin main

    Replace main with the relevant branch name if different.

  2. Install New Dependencies

    If new dependencies have been added, install them using:

    pip install -r requirements.txt
  3. Apply New Migrations

    Execute the migration commands if there are new changes:

    python manage.py migrate

Troubleshooting

  • Network Errors: Confirm that the virtual environment is activated and dependencies are properly installed.
  • Database Issues: Verify the .env file contains the correct DATABASE_URL settings.
  • Permission Issues: Ensure commands are executed with appropriate permissions or consult system administration.

For further assistance, consult the Django documentation or seek help from team members.

Contributing

Contributions to the project are welcome. Please submit a pull request with your changes and adhere to the project's contribution guidelines outlined in the repository.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages