I'm a newbie too, but I see myself also "prettying" up my
URL's with routes.py.

Is your routes.py in the correct directory?  If it is in
an application directory, it won't work.  it should be in
the web2py directory.

A hint: You can always put print statements in any of your .py files
to verify they are being executed.

For your example, I would guess routes.py would look like:

---------------------------------------------------
routes_in = ( ('admin/courses','init/admin_courses/index'),)
routes_out = ( ('init/admin_courses/index', 'admin/courses'),)
print "routing lists initialized..."
---------------------------------------------------

and it would be in your web2py directory.

(...time passes, trying it out....)

I discovered one other thing!  If you edit routes.py, SHUTDOWN AND
RESTART WEB2PY!

The routing lists are initted at web2py startup, not on every http
request!

Rufus




On Aug 14, 6:26 am, fishwebby <pastelva...@gmail.com> wrote:
> Hi,
>
> I'm struggling with the routing in web2py and I'm hoping someone can
> point me in the right direction (I'm a web2py newbie).
>
> I want to change this (which works):
>
> http://127.0.0.1:8000/init/admin_courses/index
>
> to this:
>
> http://127.0.0.1:8000/admin/courses
>
> but I can't get it to work with the various routes.py files. I've
> followed the suggestions here:http://wiki.web2py.com/URL_Re_writing
> and here:http://www.web2py.com/book/default/chapter/04#URL-Rewrite
>
> and various others from this forum but I can't get anything other than
> "invalid request".
>
> I want to do this for various controllers, for example:
>
> http://127.0.0.1:8000/admin/usershttp://127.0.0.1:8000/admin/users/3/assignments
>
> (I'm coming from Rails / Symfony / Kohana so perhaps I'm trying to do
> something that isn't the web2py way?)
>
> If anyone can point me in the right direction it would be greatly
> appreciated!
>
> Many thanks
> Dave

Reply via email to