我在Django 2.2.1(也尝试过2.2.5)下运行相同的代码。使用
投放页面python manage.py runserver
将提供登录页面和管理页面。但是登录后,存在重定向到另一页example.com/worklist
的页面,该页面无法在一台计算机上运行。在其他系统上,该页面已投放。
django在第一台计算机上返回:
Using the URLconf defined in ms_worklist.urls, Django tried these URL patterns, in this order:
admin/
accounts/
logout
worklist/
The current path, worklist, didn't match any of these.
两台计算机上的代码相同:
主应用程序:
# ms_worklist/urls.py
from django.contrib import admin
from django.urls import path, include
admin.site.site_header = 'Worklist Admin'
urlpatterns = [
path('', include('pages.urls')),
path('worklist/', include('worklists.urls')) ,
path('admin/', admin.site.urls),
path('accounts/', include('django.contrib.auth.urls'))
]
工作清单应用程序:
# worklists/urls.py
from django.urls import path
from django.db.utils import OperationalError
from worklists.views import upload_csv, load_methods
urlpatterns = [
path('', upload_csv, name='worklist'),
path('ajax/load-methods/', load_methods, name='ajax_load_methods')
]