利用Django 1.3和发展服务器
我试图与:。
答案是:
Using the URLconf defined in pruebas.urls, Django tried these URL patterns, in this order:
- ^admin/
- ^correo/$
- ^login/$
- ^lang/(?Pw+)/$
- ^site_static/(?P.*)$
The current URL, , didn t match any of these.
And this is my "urls.py":
from pruebas import settings
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns( ,
# Examples:
# url(r ^$ , pruebas.views.home , name= home ),
# url(r ^pruebas/ , include( pruebas.foo.urls )),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r ^admin/doc/ , include( django.contrib.admindocs.urls )),
# Uncomment the next line to enable the admin:
url(r ^admin/ , include(admin.site.urls)),
(r ^correo/$ , mailclient.views.index ),
(r ^login/$ , kusers.views.klogin ),
# Language change
(r ^lang/(?P<lang_code>w+)/$ , kusers.views.lang ),
)
if settings.DEBUG:
urlpatterns += patterns( ,
(r ^site_static/(?P<path>.*)$ , django.views.static.serve ,
{ document_root : settings.STATIC_ROOT}),)
我认为:
(r ^lang/(?Pw+)/$, kusers.views.lang ),
将与“http://127.0.0.1:8000/lang/en”相匹配,但看来Im错。
预 收
用户/地址的代码。 py is:
def lang(request, lang_code):
request.session[ django_language ] = lang_code
return HttpResponseRedirect( "/" )
SOLVED.
问题是n。 问题在于用户的夹层电子结构。
增 编