我开发了一个名为textModif的应用。我现在正在扩展它以包括注册功能。为此,我使用django-registration模块。
我可以毫无问题地达到127.0.0.1:8000/textModif/accounts/register/。但是,当我点击提交时,我有一个错误:
Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:
^admin/doc/
^admin/
^textModif/
The current URL, accounts/register/, didn't match any of these.
URL 127.0.0.1:8000/accounts/register/确实不存在,应该是127.0.0.1:8000/textModif/accounts/register。我没有设法解决这个问题,因此我们将不胜感激。这是我的textModif模块中的urls.py:
#!/usr/bin/python
# -*- coding: UTF-8 -*-
from django.conf.urls import patterns, url
from django.conf.urls.defaults import *
from textModif import views
from django.contrib.auth.views import login, logout, password_change, password_change_done, password_reset, password_reset_done, password_reset_confirm, password_reset_complete
# name = indique la référence qu'on va utiliser dans le template {% url qqch%}
urlpatterns = patterns('',
url(r'^(index)?$', views.index, name='index'),
url(r'^demo$', views.demo, name='demo'),
url(r'^login?$', login, name='login'),
url(r'^logout$', logout, name='logout'),
url(r'^password_change$', password_change, name='password_change'),
url(r'^password_change/done$', password_change_done, name='password_change_done'),
url(r'^password_reset$', password_reset, name='password_reset'),
url(r'^password_reset/done$', password_reset_done, name='password_reset_done'),
url(r'^reset/(?P<uidb36>[0-9A-Za-z]{1,13})-(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
password_reset_confirm,
name='password_reset_confirm'),
url(r'^reset/done/$', password_reset_complete, name='password_reset_complete'),
url(r'^processLogin$', views.processLogin, name='processLogin'),
url(r'^accounts/', include('registration.urls')),
#url(r'^processSubscr$', views.processSubscr, name='processSubscr'),
url(r'^subscribe$', views.subscribe, name='subscribe'),
url(r'^process$', views.process, name='process'),
url(r'^thanks$', views.thanks, name='thanks'),
url(r'^contact$', views.contact, name='contact'),
url(r'^blog$', views.index, name='blog'),
url(r'^send$', views.send, name='send'),
url(r'^faq$', views.faq, name='faq'),
# ex: http://127.0.0.1:8000/textModif/1/
url(r'^(?P<textTask_id>\d+)/$', views.detail, name='detail'),
#url(r'^static/(?P<path>.*)$', 'django.views.static.serve',
#{'document_root': '/home/gbertran/virtualenv_1/djangoProj_1/mysite/textModif/static'})
)
#from django.contrib.staticfiles.urls import staticfiles_urlpatterns
# ... the rest of your URLconf here ...
#urlpatterns += staticfiles_urlpatterns()
谢谢!
答案 0 :(得分:0)
答案是更正模板,如评论中所示。