Wednesday, February 2, 2011

Re: Django Project - handling call to the "root" url?

Tracey

Thanks - that is a neat idea... but I only need it for that one page.
I want the rest of the (protected) admin pages to work as normal.

Derek

On Feb 2, 2:02 pm, Karen Tracey <kmtra...@gmail.com> wrote:
> On Wed, Feb 2, 2011 at 5:24 AM, Derek <gamesb...@gmail.com> wrote:
> > I need to handle a call to the root url for a site more elegantly than my
> > current.
>
> > At the moment I have:
>
> > #urls.py
> >     (r'^$', 'myproj.myapp.views.root'),
> >     #and
> >     (r'^admin/', include(admin.site.urls)),
>
> > #views.py
> > def root(request):
> >     """Handle a call to the / (root) URL address"""
> >     return redirect('/admin/')
>
> > This works, but the extra "admin/" that has been added sticks out like a
> > sore thumb on address bar the main page (which doubles as the login page).
>
> If you want the admin app accessible from root, then put it there.
> admin.site.urls does not have to be placed at r'^admin/', you can change
> that to r'' (and get rid of your r'^$' entry), then you will have admin app
> at root of your site with no admin prefix on the admin urls.
>
> Karen
> --http://tracey.org/kmt/

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment