Django警告(urls.W005)URL名称空间不是唯一的url

时间:2019-08-07 04:53:10

标签: python django django-rest-framework django-urls

嗨,我在进行迁移或使用python manage.py runserver命令时遇到此错误。

  

警告:

     

?:(urls.W005)URL名称空间“供应商”不是唯一的。您可能无法撤消此命名空间中的所有URL

     

?:(urls.W005)URL名称空间“老师”不是唯一的。您可能无法撤消此命名空间中的所有URL

这是我的应用程序目录(教室)中的urls.py:

from rest_framework_simplejwt.views import TokenRefreshView

from classroom.views.classroom import *

from .views import classroom, suppliers, teachers

urlpatterns = [path('', classroom.home, name='home'),

               path('sign-in/', SignInView.as_view(), name='get-token'),
               path('refresh/', TokenRefreshView.as_view(), name='refresh-token'),

               path('username/available/', is_username_available, name='username-available'),
               path('sign-up/', CreateUserView.as_view(), name='sign-up'),
               path('current_user/', current_user),
               path('users/', UserList.as_view()),
               path('createrfq/', createrfq.as_view()),

               path('suppliers/', include(([path('load', suppliers.QuizListView.as_view(), name='quiz_list'),
                                            path('interests/', suppliers.SupplierTruckView.as_view(),
                                                 name='supplier_trucks'),
                                            path('home/', suppliers.TakenQuizListView.as_view(),
                                                 name='taken_quiz_list'),
                                            path('quiz/<int:pk>/', suppliers.take_quiz, name='take_quiz'),
                                            path('quiz/edit/<int:pk>/', suppliers.edit_quiz, name='edit_quiz'),

                                            # teachers modules
                                            path('quiz/add/', suppliers.QuizCreateView.as_view(), name='quiz_add'),
                                            path('quiz/confirm/<int:pk>/', suppliers.QuizUpdateView.as_view(),
                                                 name='quiz_change'),
                                            path('quiz/<int:pk>/delete/', suppliers.QuizDeleteView.as_view(),
                                                 name='quiz_delete'),

                                            path('quiz/<int:pk>/question/add/', suppliers.question_add,
                                                 name='question_add'),
                                            path('quiz/<int:quiz_pk>/question/<int:question_pk>/',
                                                 suppliers.question_change, name='question_change'),

                                            path('myposts/', suppliers.QuizListView1.as_view(),
                                                 name='quiz_change_list'),
                                            path('myposts/<int:pk>/results/', suppliers.QuizResultsView.as_view(),
                                                 name='quiz_results'),

                                            path('upload/pod/<int:pk>', suppliers.pod_upload, name='model_form_upload'),
                                            # path('pod/', suppliers.image_path, name='pod'),
                                            path('financials/', suppliers.invoices, name='financials'),

                                            path('lr/<int:pk>/', suppliers.LrFormView, name='lr_form'),
                                            path('printlr/<int:pk>/', suppliers.PrintLR, name='lr_print'),
                                            path('invoice/<int:pk>/', suppliers.InvoiceView, name='invoice_edit'),
                                            path('trips/', suppliers.trips, name='supplier_trip'),
                                            path('printinvoice/<int:pk>/', suppliers.PrintInvoice,
                                                 name='invoice_print'), ], 'classroom'), namespace='suppliers')),

               path('shipper/', include(([

                                             path('editprofile/', teachers.ShipperUpdateView.as_view(),
                                                  name='update_shipper'),
                                             path('freight/', teachers.QuizListView.as_view(), name='quiz_change_list'),
                                             path('assigned/', teachers.AssignedListView.as_view(),
                                                  name='assigned_list'),
                                             path('activetrucks/<int:pk>/', teachers.take_quiz, name='take_quiz'),
                                             path('activetrucks/', teachers.QuizListView1.as_view(),
                                                  name='active_trucks'),

                                             path('rtd-items/', teachers.rtd_items.as_view(), name='rtd-items'),
                                             # this fucked up code was written by chirag gulati
                                             path('dispatched-items/', teachers.dispatched_items.as_view(),
                                                  name='dispatched_items'),
                                             path('allitems/', teachers.all_items.as_view(), name='allitems'),
                                             path('quiz/add/', teachers.QuizCreateView.as_view(), name='quiz_add'),
                                             path('quiz/<int:pk>/', teachers.QuizUpdateView.as_view(),
                                                  name='quiz_change'),
                                             path('quiz/<int:pk>/delete/', teachers.QuizDeleteView.as_view(),
                                                  name='quiz_delete'),
                                             path('quiz/<int:pk>/results/', teachers.QuizResultsView.as_view(),
                                                  name='quiz_results'),  # assign rfq
                                             path('confirm/<int:pk>/<int:bi>/<int:owner_lr>/', teachers.ConfirmRFQ,
                                                  name='ConfirmRFQ'),
                                             path('quiz/<int:quiz_pk>/question/<int:question_pk>/',
                                                  teachers.question_change, name='question_change'),

                                             # profile page
                                             path('editprofile/', teachers.ShipperUpdateView.as_view(),
                                                  name='update_shipper'),
                                             path('profile/<int:pk>/', teachers.ShowProfile, name='profile'),

                                             path('upload/', teachers.upload_batch, name='upload'),

                                             path('myitems/', teachers.UploadedItems.as_view(), name='upload_batch'),

                                             path('ajax/load-cities/', teachers.load_cities, name='ajax_load_cities'),
                                             # path('myitems/', teachers.UploadedItems.post , name='upload_batch_select'),
                                             path('packit/', teachers.packit, name='pack_it'),
                                             path('history/', teachers.DispatchHistory.as_view(), name='plan_history'),

                                             path('feedback/', teachers.Feedback_Create.as_view(), name='feedback'),
                                             path('dashboard/', teachers.Index.as_view(), name='feedback_form'),
                                             path('map', teachers.map, name='map'),
                                             path('financials/', teachers.financials, name='financials'),

                                             path('json-example1/', teachers.json_example, name='json_example'),
                                             path('dashboard/data/', teachers.chart_data, name='chart_data'),
                                             path('', teachers.json_example1, name='json_example1'),
                                             path('json-example1/data/', teachers.chart_data1, name='chart_data1'),

                                             path('calendar', teachers.event, name='calendar'),

                                             path('quiz/<int:quiz_pk>/question/<int:question_pk>/delete/',
                                                  teachers.QuestionDeleteView.as_view(), name='question_delete'), ],'classroom'), namespace='teachers')), ]

在搜索google时,我发现这是因为我的网址之一重复了,但我不知道是哪一个。我尝试替换最后一行中的名称空间:

path('quiz/<int:quiz_pk>/question/<int:question_pk>/delete/', teachers.QuestionDeleteView.as_view(), name='question_delete'), ],'classroom'), namespace='teachers')), ]

但是它给我一个新的错误,无论我用什么名字,即使是胡言乱语。发生了什么事?

0 个答案:

没有答案