gpt4 book ai didi

python - django 中的语法错误

转载 作者:太空宇宙 更新时间:2023-11-04 09:18:31 24 4
gpt4 key购买 nike

是什么导致了这个 urls.py 中的语法错误?

它说

syntax error at Line 27[(r'^xd_receiver\.html$',.....] in ursl.py.

我不知道问题出在哪里。

  urlpatterns = patterns('',
# Example:
# (r'^universityDB/', include('universityDB.foo.urls')),

# Uncomment the admin/doc line below to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
(r'^admin/', include(admin.site.urls)),
(r'^registrationForm/$','universityDB.universityDetails.views.registrationForm'),
(r'^userDetails/$','universityDB.universityDetails.views.userDetails'),
(r'^login/$','universityDB.universityDetails.views.login'),
(r'^userCreated/$','universityDB.universityDetails.views.userCreated'),
(r'^forgotPassword/$','universityDB.universityDetails.views.forgotPassword'),
(r'^passwordRecovery/$','universityDB.universityDetails.views.passwordRecovery'),
(r'^accounts/profile', 'universityDB.universityDetails.views.profile'),
(r'^xd_receiver\.html$', direct_to_template, {'template': 'xd_receiver.html'}, name='xd_receiver'),
(r'^login_facebook_connect/$', 'login_facebook_connect', name='facebook_connect_ajax'),

)

最佳答案

如果你想命名你的 URL,你必须使用 url(...) function ,即

url(r'^xd_receiver\.html$', direct_to_template, {'template': 'xd_receiver.html'}, name='xd_receiver')

……而不是:

(r'^xd_receiver\.html$', direct_to_template, {'template': 'xd_receiver.html'}, name='xd_receiver')

关于python - django 中的语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5561630/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com