Notes on IIS configuration for web2py

190 views
Skip to first unread message

Tim Richardson

unread,
Oct 27, 2014, 9:05:05 PM10/27/14
to web...@googlegroups.com
For sure we can make better notes. But for what it's worth, these are my notes on getting web2py working on IIS. Including Simone's solution to IIS clobbering requests when they created or modified .py files.


I hope this helps as an interim measure.

By the way, apache on windows is a very stable and familiar way of hosting web2py under windows unless the single process fr mod_wsgi becomes a concern. Which it won't for a long time if you are careful to write good, fast-returning code since the whole theory of nginx etc is that web servers are very IO bound.

However, IIS lets fastcgi access multiple cores (like Apache mod_wsgi on linux) which was interesting to me, at least as an exercise.

Niphlod

unread,
Oct 28, 2014, 3:58:14 PM10/28/14
to web...@googlegroups.com
I'll revise this and provide (hopefully) something automatic to let this work without too much configuration. Then we can test it and update the relevant section of the book that needs a serious update :P

Niphlod

unread,
Oct 28, 2014, 6:19:47 PM10/28/14
to web...@googlegroups.com
ok, some problems arise.
We can either go with a default script a-la "setup-web2py-nginx-uwsgi-ubuntu.sh" that takes a freshly machine "devoted" to web2py and does everything or with something else.
Unfortunately the "let's spin up a free VM to host web2py" doesn't really match web2py's user-case in Windows world.
installing python, getting a self-signed certificate, installing a database like some scripts do is unfeasible....

Even with a stripped down script (and web.config), there are some steps to do manually:
- (needs manual intervention) installing the url-rewrite module (should be there in any "sane" IIS installation....who does things without rewriting urls these days :P)
- (needs manual intervention) setting write permissions on the app-folder (here comes the first issues.... by default you just add write permissions to IIS_IUSRS that by default have read-only.....but you could want to run the app in a stricter security-config, etc etc).....
- (needs manual intervention) installing wfastcgi (although, technically, it's apache 2.0 licensed, so we could ship it in handlers/*)...@license specialists, please investigate

That being said....if we ship web.config in "examples" and you place iis_setup.ps1 in the root folder (where web2py.py lives) and you execute it, it's enough to get everything going nicely.

https://www.dropbox.com/s/ni2wbxyh1r3nrxa/iis_web2py.zip?dl=0

Please test it in a dev environment.


Derek

unread,
Oct 28, 2014, 7:00:38 PM10/28/14
to web...@googlegroups.com
So, I've tried those instructions, stumbled and tripped and fell and gave up. I tried to stick with official python.org binaries, and ran into some issues. i then installed python 2.7.3 via the microsoft installer, and it installs, but puts it in python27_x86 which screws up all your installed libraries. And you have to reinstall win32all again, and because you reinstalled win32all you have to reinstall wfastcgi... anyway, I gave up after getting my python all patched up and working again. Turns out greenlet won't work unless you have 2.7.5 (no reason why) but Microsoft only lets you install 2.7.3 via their web installer. In any case, it would be nice to have an installer where it checks your setup and tells you what to fix, like an interactive installer / iis setup configuration checker. like so...

checking wfastcgi... installed.
checking python 2.7.5.... wrong version! go here to download....
checking iis 7+ .... installed 8x
checking...

Tim Richardson

unread,
Oct 28, 2014, 10:23:04 PM10/28/14
to web...@googlegroups.com
In my case, I use activestate python 32 bit. Nothing from microsoft except for the one script wfastcgi.py.

Niphlod

unread,
Oct 29, 2014, 4:39:17 AM10/29/14
to web...@googlegroups.com
I use the python.org installer (2.7.8) without problems.

Niphlod

unread,
Oct 29, 2014, 3:51:51 PM10/29/14
to web...@googlegroups.com


On Wednesday, October 29, 2014 12:00:38 AM UTC+1, Derek wrote:
So, I've tried those instructions, stumbled and tripped and fell and gave up. I tried to stick with official python.org binaries, and ran into some issues. i then installed python 2.7.3 via the microsoft installer, and it installs, but puts it in python27_x86 which screws up all your installed libraries. And you have to reinstall win32all again, and because you reinstalled win32all you have to reinstall wfastcgi... anyway, I gave up after getting my python all patched up and working again. Turns out greenlet won't work unless you have 2.7.5 (no reason why) but Microsoft only lets you install 2.7.3 via their web installer. In any case, it would be nice to have an installer where it checks your setup and tells you what to fix, like an interactive installer / iis setup configuration checker. like so...

checking wfastcgi... installed.
checking python 2.7.5.... wrong version! go here to download....
checking iis 7+ .... installed 8x
checking...

I'm not sure what you're asking is feasible.
First of all, if you can't run "python web2py.py" you SHOULDN'T need to put web2py behind iis.
Second, if your app needs some libraries that are incompatible with a standard python setup, there's no script in the world that will fix that.
wfastcgi is only a pure-python script, with NO REQUIREMENTS whatsoever if not for standard library modules.
Wherever you have it, it doesn't matter (that's why I was asking for @license guys to check if we can ship it within web2py).
The installer from microsoft just puts it under Scripts/*.
The python version is irrelevant (given that there's a python 2.7.8, I'd go for that as it is the last version, but it's not a requirement). And of course, we're talking about something that can be deployed in IIS 7+, so if you have IIS 6 this script isn't for you.

Derek

unread,
Oct 30, 2014, 3:45:31 PM10/30/14
to web...@googlegroups.com
It's definitely possible. And yes, you can run it without IIS, just if you want to configure Kerberos authentication using secure windows credentials (because of corporate IT policies), you kind of need it behind iis.

Niphlod

unread,
Oct 30, 2014, 4:11:57 PM10/30/14
to web...@googlegroups.com
my point is different: you can't complain about the script not working if you haven't an existing python setup that lets your app run in web2py.
Once you have it running "in standalone mode", the script will put it behind iis.
Reply all
Reply to author
Forward
0 new messages