1) I try to setup a new web environment to host python + psycopg2
code. Here are my steps :

2) Download http://modwsgi.googlecode.com/files/mod_wsgi-win32-ap22py26-3.0.so

3) Copy mod_wsgi-win32-ap22py26-3.0.so to C:\Program Files\Apache
Software Foundation\Apache2.2\modules, and rename it as mod_wsgi.so

Add the following new lines into C:\Program Files\Apache Software
Foundation\Apache2.2\conf\httpd.conf

LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias /wsgi/ "C:/Program Files/Apache Software Foundation/
Apache2.2/htdocs/wsgi/"

4) Save a file named C:\Program Files\Apache Software Foundation
\Apache2.2\htdocs\wsgi\myapp.py with the following content :

def application(environ, start_response):
    status = '200 OK'
    output = 'Hello World!'

    response_headers = [('Content-type', 'text/plain'),
                        ('Content-Length', str(len(output)))]
    start_response(status, response_headers)

    return [output]

5) Access using http://localhost/wsgi/myapp.py

6) Install 
http://www.stickpeople.com/projects/python/win-psycopg/psycopg2-2.0.13.win32-py2.6-pg8.4.1-release.exe

7) If I modify the file content to

import psycopg2

def application(environ, start_response):
    status = '200 OK'
    output = 'Hello World!'

    response_headers = [('Content-type', 'text/plain'),
                        ('Content-Length', str(len(output)))]
    start_response(status, response_headers)

    return [output]

I will get

ImportError: No module named psycopg2

How can I tell apache, I had install the psycopg2 module in C:
\Python26

8) I run the following standalone script to show psycopg2 had been
installed.

import psycopg2

print "Hello, World!"

I run it using

C:\Documents and Settings\yan-cheng.cheok\Desktop>mypython.py
Hello, World!

Seem my python environment is OK.

Any suggestion?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to