관리 메뉴

Silver Library (Archived)

Debug [Django] - exceptions.ImproperlyConfigured 본문

Personal DB

Debug [Django] - exceptions.ImproperlyConfigured

Chesed Kim 2021. 1. 5. 00:21
반응형

I have tried to remove that namespace on config/urls.py The error occurs when I pressed save button and neither 'runserver' via python manage.py does not work. 

 

Related files(suspect):

1. config/urls.py 2.templates/nav.html, 404.html, base.html, login.html 3. templates/users/urls.py, views.py 

 

Jango version v.2.2.5

 

It all worked well, but now none of terminal is working.

First Try:

atez.kagamine.me/30

 

Django url()에서 include()함수 사용시 발생하는 컴파일 에러

장고를 사용하다 보면, 다음과 같은 에러를 볼 수 있다. 'Specifying a namespace in include() without providing an app_name ' django.core.exceptions.ImproperlyConfigured: Specifying a namespace in incl..

atez.kagamine.me

* deleted namespace from config/urls.py

 

urlpatterns = [

    path("", include("core.urls", namespace="core")),

    path("rooms/", include("rooms.urls", namespace="rooms")),

    path("users/", include("users.urls", namespace="users")),

    path("admin/", admin.site.urls),

]

 

to 

 

urlpatterns = [

    path("", include("core.urls")),

    path("rooms/", include("rooms.urls")),

    path("users/", include("users.urls")),

    path("admin/", admin.site.urls),

]

 

Consequence:

Terminal error changed...?

It says: does not have any patterns in it...or probably caused by a circular import?

I must be patient now...hopefully, I could solve this mystery by tomorrow morning.

------------

from django.urls import path

from . import views

 

app_name = "users"

 

urlpatterns = [path("login", views.LoginView.as_view(), name="login")]

 

------#<edited>

 

from django.urls import path

from . import views

 

app_name = "users"

 

urlpatterns = [path("login", views.LoginView.as_view()]

 

Consequence : same

 

anyway, users.urls regard to error message

django.core.exceptions.ImproperlyConfigured:

=================================

<Jan 05th> Debug [Django] - exceptions.ImproperlyConfigured

 

Good news:

This is caused by its own code. None of jango add-ons made error.

I had to review them all again.

 

1. config/urls.py, settings.py was innocent.

2. templates/ were innocent. html was innocent.

Wait, this is not that important. The error message in terminal is: in raise_error

 

I got it. This is an error for inheritance. Let's not fear to read the error message.

Then I should not delete that migration files...?

 

final error message:

django.db.migrations.exceptions.NodeNotFoundError:

 

Verdict:

It all happened due to the absence of migration files. I should never delete this with no backup.

Be sure to commit on git before I ever deleting its file. Really.

 

Solution:

Manually created migration files.

 

Mission Accomplished!

rooms/migrations clash was the issue.

Why? I deleted files in the migrations folder of rooms folder.

 

By referring the following link, manually create that missing file.

stackoverflow.com/questions/50916493/django-migrations-django-db-migrations-exceptions-nodenotfounderror

 

Django migrations - django.db.migrations.exceptions.NodeNotFoundError

I get the following error when I run any python manage.py function: raise NodeNotFoundError(self.error_message, self.key, origin=self.origin) django.db.migrations.exceptions.NodeNotFoundError: Mig...

stackoverflow.com

 

Heritage is the key role to fix this issue. All migration files(autosave) will begins from __init__.py

 

Yes, I found the answer.

<system>Hope greatly rise