The following istructions have been adapted from
http://jdoe.asidev.com/2009/02/26/configure-web2py-to-run-behind-apache-with-wsgi-mod_wsgi/
for my dev enviroment Windows + Apache + mod_wsgi.
I  succesfully tested connection to db2 express from IMB through
pyodbc. Maybe it could help you.
I premise that I'm not a programmer and computer development is an
hobby for me, so my support will be very poor.
Below enviroment has been used for development only, not in
production.

PREREQUISITES: python 2.7 installed on Windows

STEP A - webserver preparation [http://sourceforge.net/projects/
miniserver/files/Uniform%20Server/7.1.11-Orion/]
a1 - download and install uniformserver;
a2 - after installation, access to the server administrator panel and
"SECURE" all entries in the "Server Security" page;
a3 - generate a new SSL certificate by "Tools > Server Key & Cert Gen"
link on right sidebar;
a4 - create a certificate signed by our CA using UniServer_CA_1.0
plugin [http://sourceforge.net/projects/miniserver/files/Plugins/
UniServer_CA/];
a5 - replace the files created in the a3 step in X:\UniServer\usr\local
\apache2\conf folder ( X is the drive where uniformserver has been
installed );
a6 - install new certificate in Trusted Certification Authorities.
Usually I put ca.crt file in main folder of my website, start the
server, and by browser go to http://localhost/ca.crt
         ( replace localhost with website name to simulate real situation )
and install the certificate following browser instructions;
a7 - start the server and check that https pages are accessible
without certificate errors.
Notes: when upgrade the server simply copy in their folders on the new
server the SSL files created in the previous version of the server

STEP B - mod_wsgi [http://code.google.com/p/modwsgi/wiki/
DownloadTheSoftware?tm=2]
b1 - download Windows binary selecting the correct one for the version
of Python and Apache that is being used ( I use mod_wsgi-win32-
ap22py27-3.3.so - Apache 2.2 / Python 2.7 );
b2 - stop UniServer, rename downloaded file in "mod_wsgi.so" and put
it in X:\UniServer\usr\local\apache2\modules folder ( X is the drive
where uniformserver has been installed );
b3 - add to X:\UniServer\usr\local\apache2\conf\httpd.conf file
following row: "LoadModule wsgi_module modules/mod_wsgi.so"( without
quotation marks );
b4 - restart UniServer and check that mod_wsgi is succesfully
installed.
Notes: when upgrade the server repeat the step B

STEP C - web2py (for sure you know where download it)
c1 - download web2py source code and unzip it in X:\UniServer\www
folder ( X is the drive where uniformserver has been installed );
c2 - stop UniServer, start web2py server in standard way by double
clicking X:\UniServer\www\web2py\web2py.py in order that it create its
own files (don't change default settings);
c3 - stop web2py server and check that in web2py folder there are
"options_std.py" e "parameters_8000.py";
c4 - open options_std.py and make sure of row "password = '<recycle>'"
is present;
c5 - create following symlinks (only in windows7 by "mklink" command
or using "Symlink Creator" [http://code.google.com/p/symlinker/
downloads/list]):
         1) options_std.py -> options.py
         2) parameters_8000.py -> parameters_80.py
         3) parameters_8000.py -> parameters_443.py
Notes: in windowsXP copy files listed above on the left and rename
them with the names on the right.
           When upgrade web2py, rename or delete previous web2py folder, but
in the latter case make sure of backup your web2py apps.

STEP D - apache vhost file
d1 - stop UniServer, create a new "vhost_web2py.conf" file in X:
\UniServer\usr\local\apache2\conf folder ( X is the drive where
uniformserver has been installed ) with following content :

                        ##########VIRTUAL HOST SETUP##########
                        # WEB2PY.LOCALHOST
                        <VirtualHost ****LIP****:80>
                        ServerName ****SVN****:80
                        DocumentRoot ****DIR****/www/web2py
                        WSGIScriptAlias / ****DIR****/www/web2py/wsgihandler.py
                        ServerAdmin ****EMAIL****
                        # static files do not need WSGI
                        <LocationMatch "^(/[\w_]*/static/.*)">
                        Order Allow,Deny
                        Allow from all
                        </LocationMatch>
                        # everything else goes to web2py via wsgi
                        <Location "/">
                        Order deny,allow
                        Allow from all
                        </Location>
                        # Log. Can be disabled
                        LogFormat "%h %l %u %t \"%r\" %>s %b" common
                        LogLevel notice
                        CustomLog ****DIR****/tmp/web2py.access.log common
                        ErrorLog ****DIR****/tmp/web2py.error.log
                        </VirtualHost>
                        
#------------------------------------------------------------
                        <VirtualHost ****LIP****:443>
                        ServerName ****SVN****:443
                        ServerAdmin ****EMAIL****
                        DocumentRoot ****DIR****/www/web2py
                        WSGIScriptAlias / ****DIR****/www/web2py/wsgihandler.py
                        # static files do not need WSGI
                        <LocationMatch "^(/[\w_]*/static/.*)">
                        Order Allow,Deny
                        Allow from all
                        </LocationMatch>
                        <Location "/">
                        Order deny,allow
                        Allow from all
                        </Location>
                        <Directory "****DIR****/www/web2py">
                        Order allow,deny
                        Deny from all
                        </Directory>
                        LogFormat "%h %l %u %t \"%r\" %>s %b" common
                        LogLevel notice
                        CustomLog ****DIR****/tmp/web2py.access.log common
                        ErrorLog ****DIR****/tmp/web2py.error.log
                        SSLEngine on
                        SSLProtocol -all +TLSv1 +SSLv3
                        SSLCipherSuite 
HIGH:MEDIUM:!aNULL:+SHA1:+MD5:+HIGH:+MEDIUM
                        SSLCertificateFile 
****DIR****/usr/local/apache2/conf/ssl.crt/
web2py.crt
                        SSLCertificateKeyFile 
****DIR****/usr/local/apache2/conf/ssl.key/
web2py.key
                        SetEnvIf User-Agent ".*MSIE.*" \
                        nokeepalive ssl-unclean-shutdown \
                        downgrade-1.0 force-response-1.0
                        </VirtualHost>
                        ##########END VIRTUAL HOST SETUP##########

        IMPORTANT NOTES:
                replace in above code
                ****LIP**** with real IP i.e. 192.168.1.114 for LAN or
208.67.220.222 for WAN
                ****SVN**** with your server name i.e. web2py.localhost
                ****DIR**** with X:/UniServer ( X is the drive where 
uniformserver
has been installed )
                ****EMAIL**** with your email i.e. [email protected]
                modify paths in line with your preferences

d2 - at the end of X:\UniServer\usr\local\apache2\conf\httpd.conf file
add "Include conf/vhost_web2py.conf";
d3 - create, like in step A, the SSL certificate and key for the
servername (i.e. web2py.localhost). Note that SSL permits only one
certificate for each IP;
d4 - open "%WINDOWS%\system32\drivers\etc\hosts" file and add the
alias "127.0.0.1 web2py.localhost". Replace server's IP to 127.0.0.1
and access to web2py from not localhost;
d5 - start UniServer, now you can access to web2py inserting
"web2py.localhost" in address bar of your browser.
Notes: when upgrade UniServer, repeat only d2 and copy the old files
in the upgraded server.

Final notes related to pyodbc (attention!only connection and basic
insert tested):
- pyodbc ( pyodbc-2.1.11.win32-py2.7.exe ) installed
- driver odbc activated in windows control panel
- DAL connection string = 'db2://
DSN=databasename;UID=userid;PWD=password'

Ciao.

On 4 Ott, 17:51, Omi Chiba <[email protected]> wrote:
> Is anybody running web2py with this configuration  ? If so, can you
> share the instruction and/or apache configuration ?
>
> web2py dirctory: C:\web2py
> App:http://localhost:8000/welcome
>
> Currently, my web2py site is running on
>
> - Ubuntu + Apache + wsgi
> - Windows + Apache + wsgi
>
> but because of the issues below, I cannot use pyodbc to connect
> msssql. So I was forced to use mysql.
>
> pyodbc
>
> Issue (Linux)http://code.google.com/p/pyodbc/issues/detail?id=169
> Issue (Windows)  http://code.google.com/p/pyodbc/issues/detail?id=126&q=wsgi

Reply via email to