Deploying Django on Windows

Instructions based on Windows Server 2008 R2, Server 2012 or Windows 7 as those are my only tested so far.

Ported from https://www.mattwoodward.com/2016/07/23/running-a-django-application-on-windows-server-2012-with-iis/



Required Installations

Virtual Environments

Test basic installation

Skip this if you don’t want to test an installation of python and django at its most basic.

Install the file downloaded in step 5 above then:

cd C:\Python36
python.exe -m pip install --upgrade pip
cd Scripts
pip.exe install virtualenvs
cd C:\Apps\virtualenvs
C:\Python36\Scripts\virtualenv.exe test_proj
pip install django
cd C:\Apps
django-admin startproject test_proj
cd test_proj
python manage.py migrate
python manage.py runserver
deactivate # this is a special command, just type it like that.

New Environment

cd C:\Apps\virtualenvs
C:\Python36\Scripts\virtualenv.exe django_forms

Activating Environments

# Your console command line should now be prepended with (django_forms)

Cloning the repo

Within command prompt:

cd C:\Apps
git clone <REPO_URL> django_forms
pip install -r requirements.txt

Configuring IIS

Configure FastCGI

Name: DJANGO_SETTINGS_MODULE Value: django_forms.settings_prod 
Name: PYTHONPATH Value: C:\Apps\django_forms 
Name: WSGI_HANDLER Value: django.core.wsgi.get_wsgi_application()

Configure A New Site

Site name: what ever you want
Physical path: **C:\Apps\django_forms\**
Configure Binding as needed or leave blank for all
Click OK