thanks.
davep
Mark
I think you will need to create a isapi wsgi setup script something
like this in your pylons app root directory:
from pylons import wsgiapp
demo_app = wsgiapp.PylonsApp()
import isapi_wsgi
# The entry points for the ISAPI extension.
def __ExtensionFactory__():
return isapi_wsgi.ISAPISimpleHandler(demo = demo_app)
if __name__=='__main__':
# If run from the command-line, install ourselves.
from isapi.install import *
params = ISAPIParameters()
# Setup the virtual directories - this is a list of directories our
# extension uses - in this case only 1.
# Each extension has a "script map" - this is the mapping of ISAPI
# extensions.
sm = [
ScriptMapParams(Extension="*", Flags=0)
]
vd = VirtualDirParameters(Name="isapi-wsgi-pylons-demo",
Description = "ISAPI-WSGI Pylons Demo",
ScriptMaps = sm,
ScriptMapUpdate = "replace"
)
params.VirtualDirs = [vd]
HandleCommandLine(params)
Then run the script
python setup-pylons.py
And you should be able access it by the url:
http://localhost/isapi-wsgi-pylons-demo/
Hopefully this helps.
Another option would be to use fastcgi for IIS and flup. I know this
works well with Pylons under apache and it should work for IIS.
http://www.caraveo.com/fastcgi/
Regards
Mark
On 8/17/06, primco <pri...@gmail.com> wrote:
>
Using
iis5.1
wsgiref library from http://cvs.eby-sarna.com/wsgiref/
python 2.4.3
I can run the plain isapi pywin32 samples like advanced.py
I've tried turning on tracing as in the readme but that doesn't change
anything. Should I be looking for trace output somewhere else?
btw: There seems to be a newer version of wsgiref.
http://cheeseshop.python.org/pypi/wsgiref
thanks
from paste.deploy import loadapp
import os
wsgiapp = loadapp('config:C:\code\iis\development.ini',
relative_to='c:\code\iis')
import isapi_wsgi etc....
(I had to hardcode the paths to my application to get it to install)
Anyhow, now when i run my app on a system that can run the isapi-wsgi
demo apps, i get a page that says "Unspecified Error"
these error pages are really annoying! where are the real errors going?
and how are they being supressed? i'd like to turn that behavior off
during development.
thanks again. seems like i'm getting close.
To actually see the output as it is produced, start a DOS prompt, and
run the file "win32traceutil.py" (eg, double-click on it from
Explorer, or "python.exe win32traceutil.py") This will print all
output from all other Python processes (that have imported
win32traceutil) until you kill it with Ctrl+Break!)
You should ensure that only one "collector" process is running at a
time. If not, only one of the collector processes will see the output
- although which process gets which bit of output is indeterminate!
Mark
First error I got was the result of not being able to find an egg that
is in the root of the folder that contains my setup-pylons.py script.
This is the folder I passing in to loadapp. 'c:\code\iis'. Strange. I
made an egg link in my site-packages back to it and then it got past
that import. But then I got another error that it can't find WSGIUtils
(which is already properly installed in site-packages).
File
"c:\python24\lib\site-packages\PasteDeploy-0.9.6-py2.4.egg\paste\deploy\loadwsgi.py",
line 552, in find_egg_entry_point
pkg_resources.require(self.spec)
File
"c:\python24\lib\site-packages\setuptools-0.6c1-py2.4.egg\pkg_resources.py",
line 585, in require
needed = self.resolve(parse_requirements(requirements))
File
"c:\python24\lib\site-packages\setuptools-0.6c1-py2.4.egg\pkg_resources.py",
line 483, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: WSGIUtils==0.7
This happens on 3 different systems.
The import errors were the result of having eggs that were in zip
format instead of folders. I manually expanded them into folders and
got around the errors. I have no idea why it doesn't work. I tried
'import zipimport', on a tip that that might be the culprit, in my
script and I am able to import it.
So after that, I was still not getting a response from my app. Say my
app serves up index.html in its root folder. This url does not work:
http://localhost/isapi-wsgi-pylons-demo/index.html
Turns out that this code chunk
demo_app = loadapp('config:C:/code/iis/development.ini',
relative_to='C:/code/iis/')
def __ExtensionFactory__():
return isapi_wsgi.ISAPISimpleHandler(demo = demo_app)
sends a dictionary of apps that looks like
{'demo': <paste.registry.RegistryManager object at 0x01F14F70>}
to the ISAPISimpleHandler and this code chunk
if url[-1] == "/":
url = url[:-1]
sn = fixScriptname(ecb.GetServerVariable('SCRIPT_NAME'))
wsgi_appname = sn.split("/")[-1]
application = self.apps.get(wsgi_appname, None)
which results in a base URL for my app of
http://localhost/isapi-wsgi-pylons-demo/demo/index.html
so all my pages start here. I'd like to reduce this to just one level
deep:
http://localhost/isapi-wsgi-pylons-demo/index.html
So what would you recommend to shorten this and have my app be the same
as the virtual directory? I see how it allows multiple WSGI apps at the
base but I have that handled upstream with pylons.
Other things of note:
You must stop and restart the IIS service in order to have code changes
reflected on a reload of the page. (stopping and starting the website
will not do it)
Mark
I have tested it and I now have integrated IIS auth working for my
pylons apps. This was the actual goal.
use integrated authentication on the web virtual dir and turn off anon.
Then hit the page via IE, you'll get eviron variables like this:
'HTTP_AUTHORIZATION': 'Negotiate TlRMTVNTUAA.......'
and later the user id that authenticated is specified:
'REMOTE_USER': 'GTEST\\Administrator'
logging in via firefox you get
'HTTP_AUTHORIZATION': 'NTLM TlRMTVNTUAADAA.......'
'REMOTE_USER': 'GTEST\\Administrator'
http://pylonshq.com/project/pylonshq/wiki/ServePylonsWithIIS