来自django.conf.urls
导入网址
urlpatterns = [
'chat.views',
url(r'^$', 'about'),
url(r'^new/$', 'new_room'),
url(r'^(?P<label>[\w-]{,50})/$', 'chat_room'),
]
任何人都可以帮助我
答案 0 :(得分:0)
尝试以下代码
from chat import views
from django.conf.urls import url
urlpatterns = [
url(r'^$', views.about, name='about'),
url(r'^new/$', views.new_room, name='new_room'),
url(r'^(?P<label>[\w-]{,50})/$', views.chat_room, name='chat_room'),
]
答案 1 :(得分:0)
您不应在视图参数中使用字符串。试试这个:
from chat.views import about, new_room, chat_room
from django.conf.urls import url
urlpatterns = [
url(r'^$', about),
url(r'^new/$', new_room),
url(r'^(?P<label>[\w-]{,50})/$', chat_room),
]