This post on Stackoverflow helped me solve my 
problem: 
http://stackoverflow.com/questions/3613594/web-py-url-mapping-not-accepting


On Thursday, May 3, 2012 2:34:24 PM UTC-7, Shane Cleveland wrote:
>
> 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:
>
> <VirtualHost foo.com:80>
>     ServerName foo.com
>        ServerAlias foo.com
>        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/
>       RewriteRule ^(.*)$ code.py/$1 [PT]
>     </Location>
> </VirtualHost>
>
> Here is my directory structure:
>
> foo.com
>     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
> render = web.template.render('/srv/www/foo.com/templates/', base='layout')
>
> # 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 """
>  return render.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'
> )
>
> But the index page also shows if I go to http://foo.com/page
>
> Do I need to change urls in code.py some other way?
>
> Thank you for any suggestions!
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/webpy/-/MIEfmeJnft0J.
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/webpy?hl=en.

Reply via email to