Django Project: namespace 'admin' isn't unique

前端 未结 3 1565
时光取名叫无心
时光取名叫无心 2021-01-22 15:40

on trying to run C:\\Python34/python manage.py makemigrations, I get the following error:

Error

WARNINGS: ?: (urls.w005) URL namespace \         


        
3条回答
  •  深忆病人
    2021-01-22 16:00

    You are correct in that the error stems from repeating path('admin/', admin.site.urls), in all of your url.py files. It is normally only declared at the root level as others have pointed out.

    Think of it like this - You wouldn't want to have a separate admin interface for each app, rather you would want to be able to manage all of your apps from one admin interface which is exactly what occurs when you have it only in the root urls.py file.

    Also, although the apps should be modular and independent they still need to be connected to a project to work.

提交回复
热议问题