run django localhost server
Open a command prompt or terminal window.
Navigate to the directory where your Django project is located using the "cd" command, for example:
cd path/to/your/django/project
Activate your virtual environment if you are using one. Use the following command:
source venv/bin/activate # For Linux/Mac
orvenv\Scripts\activate # For Windows
Run the following command to start the Django development server:
python manage.py runserver
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.
Open your web browser and go to the specified address (usually http://127.0.0.1:8000/) to view your Django project.
To stop the server, go back to the terminal and press
CTRL+C
.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
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
Remember to handle migrations, create a superuser, and set up other necessary configurations as needed for your Django project.