Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 581209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:33:16+00:00 2026-05-13T14:33:16+00:00

1) I try to setup a new web environment to host python + psycopg2

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T14:33:16+00:00Added an answer on May 13, 2026 at 2:33 pm

    I am able to solve the problem, by moving python script outside htdocs

    WSGIScriptAlias /wsgi "C:/wsgi/"
    
    <Directory "C:/wsgi">
        AllowOverride None
        Options None
        Order deny,allow
        Allow from all
    </Directory>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 297k
  • Answers 297k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Let the element pass itself to the function by ajaxTextKill(this).… May 13, 2026 at 7:21 pm
  • Editorial Team
    Editorial Team added an answer Here is how to encode and decode a float with… May 13, 2026 at 7:21 pm
  • Editorial Team
    Editorial Team added an answer You're calling ListSame with newList, which will always only have… May 13, 2026 at 7:21 pm

Related Questions

I need help, I'm new to the WCF world having recently made the transition
I am trying to develop an asp.net site with multiple subdomains. I am new
Here is my scenario: I have a proxy that actually has the SSL Cert
I have a Web setup project. In the setup I have an input field
Hi (I'm pretty new to this), I have created a portal where the user

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.