run django app locally
Open a terminal window.
Navigate to the root directory of your Django project using the
cd
command.Activate the virtual environment for your Django project, if you are using one. Use the
source
command on Unix-like systems oractivate
on Windows. For example:source venv/bin/activate # Unix-like systems
venv\Scripts\activate # Windows
Ensure that you have all the required dependencies installed by running:
pip install -r requirements.txt
Apply any pending database migrations using the following command:
python manage.py migrate
Start the development server using the following command:
python manage.py runserver
Open your web browser and navigate to the specified address, usually http://127.0.0.1:8000/.
If you are using a different port or host, the server output in the terminal will indicate the correct address. Open that address in your web browser.
You should now see your Django app running locally. Any changes you make to your code will be automatically reflected if you are running the development server with the
runserver
command.To stop the development server, you can press
Ctrl + C
in the terminal where it is running.