I've managed to configure PyISAPIe to run Python code (eg, a simple hello world) from a new website running on IIS7, but I can't quite figure out how to get Django up and running in the same environment.
Anyone with any tips on how to make that finally link between the two?
This is a simple test server so I don't even need to bother with multiple instances. I just want to run one instance of the site at '/'.
Here's my entire isapi.py
file:
import os
import sys
from Http.WSGI import RunWSGI
from Http import Env
from django.core.handlers.wsgi import WSGIHandler as DjangoHandler
sys.path = [
'c:\parlour\site',
'c:\parlour\site\lib',
'c:\parlour\site\project'
] + sys.path
os.environ["DJANGO_SETTINGS_MODULE"] = 'project.settings'
Base = '/'
Exclude = ['/media']
def Request():
PathInfo = Env.PATH_INFO
if not PathInfo.startswith(Base):
return True
for Excl in Exclude:
if PathInfo.startswith(Excl):
return True
return RunWSGI(DjangoHandler(), Base=Base)
I think the biggest disconnect I'm having is understanding how PyISAPIe know to execute the file above. With Apache, you need to include WSGIScriptAlias / /path/to/mysite/apache/project.wsgi
. I don't see an equivalent for PyIASPIe, although it's likely I'm overlooking something obvious.