I am receiving a "not found" message in my browser when attempting to access my site as a virtualhost on apache with mod_wsgi. No errors are printed.
Here is my VirtualHost code in httpd-vhosts.conf:
DocumentRoot /srv/www/foo.com/public_html/ ErrorLog /srv/www/foo.com/logs/error.log CustomLog /srv/www/foo.com/logs/access.log combined
WSGIScriptAlias / /srv/www/foo.com/application Alias /static /srv/www/foo.com/public_html
<Directory /srv/www/foo.com/application> SetHandler wsgi-script
Options ExecCGI FollowSymLinks
# Options +FollowSymLinks
</Directory>
AddType text/html .py
<Location />
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !^/static
RewriteCond %{REQUEST_URI} !^(/.*)+
code.py/ </Location>
</VirtualHost>
Here is my directory structure:
application
code.py
model.py
logs
public_html
css
js
templates
index.html
layout.html
etc ...
Here is my code.py:
#!/usr/bin/env python
# import the web.py module
import sys, os
abspath = os.path.dirname(__file__)
sys.path.append(abspath)
os.chdir(abspath)
import web
import model
# look for templates
# url structure
urls = (
'/', 'Index',
'/page', 'Page'
)
app = web.application(urls, globals())
class Index:
def GET(self):
""" Show Index Page """
return render.index()
class Page:
def GET(self):
""" Show Page """
# create application and tell it to start
if __name__ == "__main__":
app.run()
app = web.application(urls, globals(), autoreload=False)
application = app.wsgifunc()
I am able to get the homepage to show up if I go to
http://foo.com if I change urls in code.py to:
# url structure
urls = (
'.*', 'Index',
'/page', 'Page'
)
Do I need to change urls in code.py some other way?
Thank you for any suggestions!