Re: url - hot to set properly?
Hi,
> urlpatterns = patterns('',
> url(r'^admin/', include(admin.site.urls)),
> (r'^', include('apps.textcontent.urls')),
> )
> when i pass: /admin/ all is ok, but when I pass /admin -
> apps.textcontent.urls are executed, but why?
Well because the URL pattern is a regular expression that is matched
against the URL, and you explicitly stated that there has to be a / at
the end.
Change it to url(r'^admin/?',…) and it will work both with '/admin' and
'/admin/'.
But: this is bad URL etiquette. You should choose a schema (/ or not)
and stick with it. Even better: create a view that matches the opposite
of your chosen schema and permanently redirects to the correct URL (or
enable normalisation in your webserver, that would be easier)
--
Pascal Germroth
--
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.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home