누군가 나를 도울 수 있습니까? 프로젝트를로드 할 때 다음 오류가 발생합니다.
raise ImproperlyConfigured (msg.format (name = self.urlconf_name)) django.core.exceptions.ImproperlyConfigured : 포함 된 URLconf 'siteV1.urls'에 패턴이없는 것 같습니다. 파일에 유효한 패턴이있는 경우 순환 가져 오기로 인해 문제가 발생한 것일 수 있습니다.
이것은 내 urls.py입니다.
from django.contrib import admin
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from drink.views import HomepageView, CreateDrinkView, CreateNormalDrinkView, CreateMixedDrinkView
from machine.views import SettingsView
from account.views import LoginView
urlpatterns = [
path('', HomepageView.as_view()),
path('create-drink', CreateDrinkView.as_view()),
path('create-drink/save-normal', CreateNormalDrinkView.as_view()),
path('create-drink/save-mixed', CreateMixedDrinkView.as_view()),
path('settings/', SettingsView.as_view()),
path('accounts/login/', LoginView.as_view()),
path('admin/', admin.site.urls),
]
if settings.DEBUG == True:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
else:
pass
#enter code here for media and static handeling during production
문제는 LoginView 가져 오기와 관련된 것 같습니다. 이 가져 오기 및 경로를 삭제하면 프로그램이 오류없이 실행됩니다. My accounts.views에는 다음 코드가 포함되어 있습니다.
from django.contrib.auth import authenticate, login
from django.shortcuts import render, redirect
from django.views.generic import TemplateView
# Create your views here.
class LoginView(TemplateView):
template_name = 'login.html'
def get(self, request):
return render(request, self.template_name, {})
def post(self, request):
username = request.POST['username']
password = request.POST['password']
user = authenticate(request, username=username, password=password)
if user is not None:
login(request, user)
# Redirect to a success page.
return redirect('')
else:
# Return an 'invalid login' error message.
return render(request, self.template_name {'error': 'Gebruikersnaam of wachtwoord onjuist!'})
account.models는 현재 비어 있습니다. 순환 가져 오기를 확인하기 위해 pycycle을 실행 해 보았습니다. Pycycle은 순환 가져 오기를 찾을 수 없다고 반환했습니다. 귀하의 도움에 감사드립니다!
앱을 삭제하고 다시 생성하여이 문제를 해결했습니다. 여전히 문제가 무엇인지 모르지만 지금은 작동합니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다