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

  • Home
  • SEARCH
  • 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 4324600
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T09:09:16+00:00 2026-05-21T09:09:16+00:00

I have a file test.py at /var/www and I am using apache2 on ubuntu

  • 0

I have a file test.py at /var/www and I am using apache2 on ubuntu 10.10. I have mod_python installed and /etc/apache2/sites-available/default configured as

<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride AuthConfig
    Order allow,deny
    allow from all

    AddHandler mod_python .py
    PythonHandler mod_python.publisher
    PythonDebug On

    # Uncomment this directive is you want to see apache2's
    # default start page (in /apache2-default) when you go to /
    #RedirectMatch ^/$ /apache2-default/
</Directory>

If it put

def index(req):
  return "Test successful";

Then i get Test successful

And if i put

#!/usr/bin/env python
print "Content-Type: text/html"
print
print """\
<html>
<body>
<h2>Hello World!</h2>
</body>
</html>
"""

I get 404: Not found error

More can be found here

Anyone any ideas ??

Regards,

experimentX

  • 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-21T09:09:17+00:00Added an answer on May 21, 2026 at 9:09 am

    mod_python looks for method def index(req) by default when it tries to handle your requests, otherwise you can specify the function which you want to call in the URL. Note that function has to return a specific value.

    So you can do something like

    s ="""\
    <html>
    <body>
    <h2>Hello World!</h2>
    </body>
    </html>
    """
    
    def index():
       return s
    

    The url travelsal under mod_python is illustrated here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some graphics files that exist within a directory that a web server
Here is my problem: I have a website running on IIS 7 + PHP
I am trying to retrieve mysql data using php(products.php) and return the data in
I'm using jquery to populate a dropdown box. Here is my code. <!DOCTYPE html
Possible Duplicate: How can I use C++ code to interact with PHP? I have
I have deployed a django project on a server running under debian lenny. Every
I am a newbie and have spent over 3 hours trying to find a
I am new to cake php and I have a plugin folder in my
I'm writing a program that sends emails to users with multiple images (charts) embedded
I am getting a fatal error from my image resize script that takes jpegs

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.