In this post, we will see how to newly setup and run an existing Django project on local Windows machine. Before starting, open the command prompt and then follow below steps-
#To go to the root directory
~
# To go to c drive or where your project directory located
cd c:// cd django
# Show files and folders from the directory
ls
# Go to the project folder
cd myproject
# Create virtual environment with a directory i.e. venv
virtualenv venv
# Now activate the virtual environment
source venv/Scripts/activate
# Check/Show python version
python --version
# Install all required packages
pip install -r requirements.txt
# Initialization form the DB migration
python manage.py makemigrations
# Excute the DB migration
python manage.py migrate
# Collect all static files
python manage.py collectstatic
# Create admin user
winpty python manage.py createsuperuser
# Run server
python manage.py runserver
# Run server in a specific port
python manage.py runserver 127.0.0.1:8000
Happy Coding 🙂
Leave a Reply