我刚刚设置了自己的 Django 服务器,但在管理页面上遇到了问题。当我尝试添加或删除用户或基本上每当我从 Django 管理页面发送 POST 请求时,我收到以下错误:Raised by: django.contrib.admin.options.changelist_viewUsing the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:^admin/^register/$ [name='register']^$^login/$ [name='login']^static\/(?P<path>.*)$The current path, auth/user/, didn't match any of these.正常页面工作正常。我只在管理页面上收到错误。我尝试过,python manage.py migrate 但没有要应用的迁移。我猜这与urls.py或settings.py文件有关。re_path('^admin/', admin.site.urls)url 模式已经存在,我不确定为什么它仍然给出错误。路径结构:-root -mysite -urls.py -settings.py -wsgi.py -views.py -forms.py -templates -static -passenger_wsgi.py -manage.py这是我的 urls.py 文件:from django.urls import re_pathfrom django.contrib import adminfrom django.conf import settingsfrom django.conf.urls.static import staticadmin.autodiscover()urlpatterns = [ re_path('^admin/', admin.site.urls), re_path('^register/$', register_page, name='register'), re_path('^$', home_page), re_path('^login/$', login_page, name='login'),] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
添加回答
举报
0/150
提交
取消