Django Project On Windows

How to setup and run an existing Django project on Windows?

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


# 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 makemigrations

# Excute the DB migration

python migrate

# Collect all static files

python collectstatic

# Create admin user

winpty python createsuperuser

# Run server

python runserver

# Run server in a specific port

python runserver

Happy Coding 🙂







Leave a Reply

Your email address will not be published. Required fields are marked *