deploying web2py on IIS

830 views
Skip to first unread message

Web2Py Freak

unread,
Sep 6, 2011, 6:03:42 AM9/6/11
to web2py-users
how can i deploy web2py on IIS ??

Massimo Di Pierro

unread,
Sep 6, 2011, 10:03:58 AM9/6/11
to web2py-users
Try this and please report errors.

Start web2py as usual on port 8000

python web2py -p 8000 -i 127.0.0.1 -a 'password'

Create:
C:\inetpub\wwwroot\web2py
C:\inetpub\wwwroot\web2py\bin
Download http://managedfusion.com/ and extract
C:\inetpub\wwwroot\web2py\Web.config

Create C:\inetpub\wwwroot\web2py\ManagedFusion.Rewriter.txt
and in it write:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain.com$ [NC]
RewriteRule ^(.*)$ http://localhost:8000$1 [P,QSA,L]

Web2Py Freak

unread,
Sep 6, 2011, 10:10:32 AM9/6/11
to web2py-users
where dose my application files go ? or my packed project go

Web2Py Freak

unread,
Sep 6, 2011, 10:16:17 AM9/6/11
to web2py-users
Massimo ,
if you may please , can you explain thing a little more this is my
first time doing this . Thank you .

Massimo Di Pierro

unread,
Sep 6, 2011, 1:43:58 PM9/6/11
to web2py-users
I am not a windows user s I am just reposting somebody else info.

I guess web2py goes in

C:\inetpub\wwwroot\web2py

and you start it from there

cd C:\inetpub\wwwroot\web2py
c:/python/python.exe web2py -p 8000 -i 127.0.0.1 -a 'password'

C:\inetpub\wwwroot\web2py\Web.config is the only file you need to
extract from http://managedfusion.com/

On Sep 6, 9:03 am, Massimo Di Pierro <massimo.dipie...@gmail.com>
wrote:
> Try this and please report errors.
>
> Start web2py as usual on port 8000
>
> python web2py -p 8000 -i 127.0.0.1 -a 'password'
>
> Create:
> C:\inetpub\wwwroot\web2py
> C:\inetpub\wwwroot\web2py\bin
> Downloadhttp://managedfusion.com/and extract
> C:\inetpub\wwwroot\web2py\Web.config
>
> Create C:\inetpub\wwwroot\web2py\ManagedFusion.Rewriter.txt
> and in it write:
>
> RewriteEngine On
> RewriteCond %{HTTP_HOST} ^yourdomain.com$ [NC]
> RewriteRule ^(.*)$http://localhost:8000$1[P,QSA,L]

Brian M

unread,
Sep 6, 2011, 10:13:24 PM9/6/11
to web...@googlegroups.com
Perhaps check out web2pyslices.com -- http://www.web2pyslices.com/slices/take_slice/128 "Install web2py  on Windows with IIS"

I haven't tried it (I just use the built-in rocket server or apache + mod_wsgi even on windows)

Good Luck

~Brian

annet

unread,
Sep 7, 2011, 2:14:04 AM9/7/11
to web2py-users
Hi,

I have seen you struggle setting up a deployment environment and
deploying your web2py app for some time now, and wonder why you not
simply decide to deploy your app at e.g Webfaction. Apart from my Mac
OS X Leopard Server I do have a hosting account there at $ 9.50 a
month, and in order to be able to access web2py's admin interface I
also have a dedicated IP address at $ 5.00 a month. Webfaction has a
script to install web2py, apart form that there documentation and
support are pretty good. I found that being new to web2py, probably
dynamic web development, and setting up a deployment environment is an
unproductive combination. After you've become more familiar with the
former the latter will be a piece of cake.

By the way, in production you do not use SQLite (see the book), but
Postgresql, MySQL, etc.


Kind regards,

Annet

Web2Py Freak

unread,
Sep 7, 2011, 3:18:06 AM9/7/11
to web2py-users
why cant i use SQLite ??

Remco

unread,
Sep 8, 2011, 8:10:49 AM9/8/11
to web2py-users
You can do IIS with WSGI: http://code.google.com/p/isapi-wsgi/ so you
don't host two webservers, but only one.

Hope this helps.

Regards,
Remco Boerma

Richard Vézina

unread,
Sep 8, 2011, 10:03:03 AM9/8/11
to web...@googlegroups.com
SQLite is a file DB so it the file is locked when there is operation in process... I think it become pretty slow when multiple users are on at the same time... I am not sure if it only allow concurrent access management correctly...

Richard

Remco

unread,
Sep 8, 2011, 11:08:38 AM9/8/11
to web2py-users
From the sqlite site:
SQLite uses POSIX advisory locks to implement locking on Unix. On
Windows it uses the LockFile(), LockFileEx(), and UnlockFile()
system calls. SQLite assumes that these system calls all work as
advertised. If that is not the case, then database corruption can
result. One should note that POSIX advisory locking is known to be
buggy or even unimplemented on many NFS implementations (including
recent versions of Mac OS X) and that there are reports of locking
problems for network filesystems under Windows. Your best defense is
to not use SQLite for files on a network filesystem.
-- http://www.sqlite.org/lockingv3.html

sqlite2 is different from sqlite3, but seems to me best not to use
sqlite if you have the option for any other database.

On 8 sep, 16:03, Richard Vézina <ml.richard.vez...@gmail.com> wrote:
> SQLite is a file DB so it the file is locked when there is operation in
> process... I think it become pretty slow when multiple users are on at the
> same time... I am not sure if it only allow concurrent access management
> correctly...
>
> Richard
>

Omi Chiba

unread,
Sep 8, 2011, 12:43:55 PM9/8/11
to web2py-users
Remco,

I'm another guy struggling with IIS.
Following the Receipt 2 for ISAPI and I'm lost at 2.3.2. If possible,
can you explain what I should do from here.

So far, virtual directory "ochibaapp" (Renamed it from appname) is
created under "Default Web Site". I have setup junction for C:\w2p
\application just like in the step and it's empty now.


http://www.web2pyslices.com/slices/take_slice/128


On Sep 8, 7:10 am, Remco <remco.boe...@gmail.com> wrote:
> You can doIISwith WSGI:http://code.google.com/p/isapi-wsgi/so you

Omi Chiba

unread,
Sep 9, 2011, 12:51:26 AM9/9/11
to web2py-users
Any information is very helpful for me if there is any IIS users who
successfully running web2py with this receipt 2 (ISAPI+WSGI).

Richard Vézina

unread,
Sep 9, 2011, 9:33:44 AM9/9/11
to web...@googlegroups.com
I don't want to suffer ;)

Richard

sherdim

unread,
Sep 9, 2011, 10:09:47 AM9/9/11
to web...@googlegroups.com
Hello Omi!

first, junction (as you read in receipt) is needed for ability to launch development version of web2py on the same source.
anyway you can copy all web2py folder and syncronize them as needed

Step 2.3.2 Configure routes - is standard for web2py and described in the book.
it sets relative path to your application files.

In the beginning you should realise where are your application directories. You should check they are workable with standard web2py.py launcher.

Then check permissions for folders - so IIS can access them with given credentials (it is described in the receipt).

you should skip 2.3.4 - it has sense on big production server if any

As I see your isapi_web2py.py script cannot access application files (directory is empty)
try at first simple copy instead junction

In the end of 2.3.1 there are typos in path - slashes are escaped - be careful or just allow "All Unknown ISAPI Extentions".

for testing try in the section for interactive launch of isapi_web2py.py script
if __name__=='__main__':
import
gluon.main
call from command line - to be sure gluon is on the path and accessible

Write here your directory configuration if you are still lost.
Think about web2py directory as a single ready application which just should plugged to IIS.

Best regards


Omi Chiba

unread,
Sep 9, 2011, 1:08:27 PM9/9/11
to web2py-users
sherdim, Thank you so much for your reply !!!!

To be honest, I cannot really understand routes even I read the book.
I don't even know if I should copy the applications under web2py
folder and/or where to ...

Here's my directories:
-----------------------------------------------
python:
C:\Python25

web2py:
C:\Python25\web2py

web2py appllications:
C:\Python25\web2py\applications

Created by 2.3. Configure WSGI handler:
C:\w2p\applications (Empty)
is link to...
C:\Python25\Lib\site-packages\applications (Empty)

I start web2py like this:
c:\Python25\web2py>python web2py.py

Virtual Directory on IIS
"ochibaapp" (renamed from "appname") under "Default Web Site"
-----------------------------------------------

sherdim

unread,
Sep 12, 2011, 11:02:33 AM9/12/11
to web...@googlegroups.com
Onmi, it is not clear - whether you have separate domain for the site under IIS. if no - then you can use default pathes.


To be honest, I cannot really understand routes even I read the book.
routes.py is not related to deployment on IIS. You can skip routes configuration upto you need/want it.

for beginners I would suppose such if your app called "ochibaapp", not "welcome":
========
routers = dict(
  BASE  = dict(default_application='ochibaapp',
    domains={ 'ochiba.com' : 'ochibaapp'    },
    root_static = ['favicon.ico', 'robots.txt', 'sitemap.xml'],
  ),
)
======

Here's my directories:
-----------------------------------------------
web2py:
C:\Python25\web2py
I am not sure - will python include gluon from this dir automatically?
More advantageous place - \Python25\Lib\site-packages\gluon

So my proposal - copy gluon dir to C:\Python25\Lib\site-packages\
 
web2py appllications:
C:\Python25\web2py\applications
so C:\w2p\ in the slice become C:\Python25\web2py in your current placement 
 
Created by 2.3. Configure WSGI handler:
C:\w2p\applications (Empty)
is link to...
C:\Python25\Lib\site-packages\applications (Empty)

reverse order!!! link (junction) the second one to C:\Python25\web2py\applications
 
I start web2py like this:
c:\Python25\web2py>python web2py.py
this can be used for development and debugging 
 
Virtual Directory on IIS
"ochibaapp" (renamed from "appname") under "Default Web Site"
this app must point to C:\Python25\Lib\site-packages\_ochibaapp.dll
or whatever name you used  (through wildcard mapping in the app config)
(According to name agreement - DLL must be named _filename.dll for filename.py )
So in the file C:\Python25\Lib\site-packages\ochibaapp.py  you can call gluon.main.wsgibase

Goodluck!

Omi Chiba

unread,
Sep 13, 2011, 11:26:06 AM9/13/11
to web2py-users
sherdim,

Thank you again! I'm ALMOST there.
I finished all the settings and excited to see the result at

http://localhost/ochibaapp/

but I got HTTP Error 500.0 - Internal Server Error.
Do you have any idea where I should check ?

I use IIS 7.5 with IIS 6 Management Cimpatibility.

Windows application log, I have the following error but I'm sure ISAPI
Filter and Extension are installed and working properly.

The description for Event ID 4097 from source ISAPI Filter or
Extension cannot be found. Either the component that raises this event
is not installed on your local computer or the installation is
corrupted. You can install or repair the component on the local
computer.

I have
C:\Python25\Lib\site-packages\ochibaapp.py
C:\Python25\Lib\site-packages\_ochibaapp.dll
C:\Python25\Lib\site-packages\applications (Now I see all the app
including ochibaapp folder)

and it's registered in IIS Virtual directory ochibaapp under "Default
Web Site".
It's automatically created by automatic installation on your post
2.3.0.

- C:\Python25\Lib\site-packages\_ochibaapp.dll is Allowed to run on
IIS.
- Folders are allowed to execute by IIS_WPG.
- I can display http://localhost/isapi-wsgi-test/

sherdim

unread,
Sep 14, 2011, 6:18:57 AM9/14/11
to web...@googlegroups.com
Hello, Omi!

 
Do you have any idea where I should check ?

I use IIS 7.5 with IIS 6 Management Cimpatibility.

1. Check you app is working through usual web2py startup.

2. if you did junction folder - set full access for IIS_WPG for the target folder "...\applications"
also check access for _ochibaapp.dll

3. check app pool in the IIS admin snap-in - most default setting are good but may be they were changed

And the main thing - relaunch all IIS services after every reconfig (restart IIS Admin service).
And remember relaunch the apppool after app changes - because IIS keeps your app ready in memory for a while

Omi Chiba

unread,
Sep 14, 2011, 12:53:22 PM9/14/11
to web...@googlegroups.com
sherdim,

I checked all including your suggesion but it just didn't work. I keep getting HTTP Error 500.
Windows event says "Failed to import callback module 'ochibaapp'"

Have you successfully working on IIS 7.5 ? 
If not, I need to say there are maybe some compatible issue with isapi-wsgi module in web2py.

Omi Chiba

unread,
Sep 15, 2011, 11:23:33 AM9/15/11
to web...@googlegroups.com
I gave up... :'-(
Start setting up Apache and it worked in one hour.

sherdim

unread,
Sep 16, 2011, 7:17:32 AM9/16/11
to web...@googlegroups.com
Hope, you will be satisfied with Apache.

I have other sites/apps on the IIS, so I wanted web2py on the same platform.

If you had default isapi_wsgi example app working - then no incompatibility with dll (32/64 bit issues etc).

if any webserver  is proper for you - you can use default web2py rocket as well IMHO.

Good luck

Dmitry Ermolaev

unread,
Oct 20, 2014, 12:55:23 AM10/20/14
to web...@googlegroups.com
may be use nssm (http://nssm.cc/usage) with:

c:\web2py\web2py.py -W install -L c:\web2py\options.py

-W install -L options.py


or with

-W install -L wsgihandler.py


?

вторник, 6 сентября 2011 г., 14:03:42 UTC+4 пользователь Hassan Alnatour написал:

Dmitri Ermolaev

unread,
Apr 3, 2016, 12:56:03 AM4/3/16
to web2py-users
I do it! Its work:
http://web2py.com/books/default/chapter/29/13/deployment-recipes#IIS

IIS much quicker than Apache - Apache load a processor at 100% for AJAX requests ((

thanx


вторник, 6 сентября 2011 г., 13:03:42 UTC+3 пользователь Hassan Alnatour написал:

Dmitri Ermolaev

unread,
Apr 3, 2016, 4:51:20 AM4/3/16
to web2py-users
wfastcgi.py for IIS and web2py

воскресенье, 3 апреля 2016 г., 7:56:03 UTC+3 пользователь Dmitri Ermolaev написал:
wfastcgi.py

Massimo Di Pierro

unread,
Apr 4, 2016, 9:59:40 PM4/4/16
to web2py-users
are you proposing this for including in web2py?

Dmitri Ermolaev

unread,
Apr 19, 2016, 10:46:15 AM4/19/16
to web2py-users
Yes! not need to downlad full MS Visual C 

вторник, 5 апреля 2016 г., 4:59:40 UTC+3 пользователь Massimo Di Pierro написал:
Reply all
Reply to author
Forward
0 new messages