Running a Django Application on IIS: Difference between revisions

From Littledamien Wiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
== Overview ==
== Overview ==


How to get a Django project hosted on an IIS server.  
How to get a Django project hosted on an IIS server. N.B that this article was originally created April 2013. The information in  it will probably become outdated very quickly.  
 
== django-windows-tools ==
 
[http://django-windows-tools.readthedocs.org/en/latest django-windows-tools]


== Prerequisites ==
== Prerequisites ==
Line 13: Line 9:
* Install Django using pip: `pip install django`<br />''Trying to use the BitNami Django Stack caused ImportExport errors when running `python manage.py collectstatic`: "no django.core.management module".)''
* Install Django using pip: `pip install django`<br />''Trying to use the BitNami Django Stack caused ImportExport errors when running `python manage.py collectstatic`: "no django.core.management module".)''
* pywin32 - Python extensions for Windows
* pywin32 - Python extensions for Windows
* [http://django-windows-tools.readthedocs.org/en/latest django-windows-tools]
== Instructions ==
[http://mrtn.me/blog/2012/06/27/running-django-under-windows-with-iis-using-fcgi/ Geek Quickies: Running Django Under Windows With IIS Using FastCGI]


== Setting up a virtualenv under Windows ==
== Setting up a virtualenv under Windows ==
All that's necessary is the instructions above. This section about setting up a virtualenv was a path that I started down but ultimately wasn't applied. Leaving this information here just in case it would be of use in the future.


* [http://djangonautlostinspace.wordpress.com/2012/04/16/django-and-windows Django and Windows]
* [http://djangonautlostinspace.wordpress.com/2012/04/16/django-and-windows Django and Windows]

Revision as of 16:29, 16 April 2013

Overview

How to get a Django project hosted on an IIS server. N.B that this article was originally created April 2013. The information in it will probably become outdated very quickly.

Prerequisites

  • Install Python 2.7 from the main distribution found after searching for "Windows python"
  • Install pip (These installers worked well)
  • Install Django using pip: pip install django
    Trying to use the BitNami Django Stack caused ImportExport errors when running python manage.py collectstatic: "no django.core.management module".)
  • pywin32 - Python extensions for Windows
  • django-windows-tools

Instructions

Geek Quickies: Running Django Under Windows With IIS Using FastCGI

Setting up a virtualenv under Windows

All that's necessary is the instructions above. This section about setting up a virtualenv was a path that I started down but ultimately wasn't applied. Leaving this information here just in case it would be of use in the future.

  • Running the command virtualenv my-proj-env --no-site-packages I was running into this error:
AssertionError: Filename c:\Python27\Lib\os.py does not start with any of these prefixes: ['c:\\python27']
  • There were two useful bits of advice in the Stackoverflow thread:
  • The path values stored in the PYTHONPATH environment variable need to match the case of the path at the end of the error message.
    In my case both the drive letter and the "p" in "python" were lowercase and all the paths needed to match, i.e. both the "c" and "p" needed to be lowercase even though the directory name was actually capitalized.
  • Once that error was resolved, I got the following
ImportError: No module named _socket
  • Which was resolved by adding "c:\python27\DLLs" to the PYTHONPATH environment variable.

See also