On 8 Mar 2013, at 6:08 AM, weheh <richard_gor...@verizon.net> wrote:
> I'm a routes.py newbie! Amazing it's taken me this long to really dive in. 
> This should be trivial, but I'm struggling to get mydomain/robots.txt to map 
> to mydomain/static/robots.txt. In fact, none of my routes_in are working. My 
> non-working routes.py file:
> 
> #!/usr/bin/python
> # -*- coding: utf-8 -*-
> 
> default_application = 'init'    # ordinarily set in base routes.py
> default_controller = 'default'  # ordinarily set in app-specific routes.py
> default_function = 'index'      # ordinarily set in app-specific routes.py
> 
> 
> routes_app = (
>     (r'/(?P<app>mydomain|admin|appadmin|other)\b.*', r'\g<app>'),
>     (r'(.*)', r'myapp'),
>     (r'/?(.*)', r'myapp'),
>     )
> 
> 
> routes_in = (
>     ('/favicon.ico', '/static/images/logo/favicon.ico'),
>     ('/robots.txt', '/static/robots.txt'),
>     ('/cgi-bin/foobar.py', '/newfoobar/index'),
>     )
> 
> 
> routes_out = (
>     ('/static/robots.txt', 'robots.txt'),
>     ('/appadmin/(?P<any>.*)', '/\g<any>'),
>     ('/mydomain/(?P<any>.*)', '/\g<any>'),
>     ('/other/(?P<any>.*)', '/\g<any>'),
>     )
> 
> 
> logging = 'debug'
> 
> 
> # Display 404 for all invalid server messages
> routes_onerror = [
>     ('*/*', '/mydomain/static/404.html'),
>     ]
> 
> 
> Also, I would like to know what the logging='debug' does? Where does the log 
> file go?

Routes uses the standard logging mechanism; use logging.conf to configure it. 
Routes logs at a configurable loglevel, so you can raise it temporarily in 
routes.py to debug your routes logic without reconfiguring logging.conf.

If you're using the pattern-matching router, you generally don't need 
routes_app unless you have multiple (per-app) routes.py files. It does *not* 
route requests themselves to apps; it simply chooses which routes.py to use if 
more than one is present.

Presumably you want to be sending /robots.txt to /myapp/static/robots.txt (and 
so on).

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to