run django localhost server

  1. Open a command prompt or terminal window.

  2. Navigate to the directory where your Django project is located using the "cd" command, for example: cd path/to/your/django/project

  3. Activate your virtual environment if you are using one. Use the following command: source venv/bin/activate # For Linux/Mac or venv\Scripts\activate # For Windows

  4. Run the following command to start the Django development server: python manage.py runserver

  5. If the server starts successfully, you should see output similar to the following: Starting development server at http://127.0.0.1:8000/ Quit the server with CONTROL-C.

  6. Open your web browser and go to the specified address (usually http://127.0.0.1:8000/) to view your Django project.

  7. To stop the server, go back to the terminal and press CTRL+C.

  8. If you want to run the server on a different port, specify the port number after the runserver command, like this: python manage.py runserver 8080

  9. To make the development server accessible from other devices on the network, run the server with the following command: python manage.py runserver 0.0.0.0:8000

  10. Remember to handle migrations, create a superuser, and set up other necessary configurations as needed for your Django project.