简体   繁体   中英

Django says ImproperlyConfigured: The included URLconf does not appear to have any patterns in it

I'm new to Django and I'm facing a problem with a repo I downloaded. I've looked at other answers, but they don't seem to apply to my project, or I don't have the same errors some have. It sends the error

File "C:\Users\Iván\AppData\Local\Programs\Python\Python36\Lib\site-packages\django\urls\resolvers.py", line 596, in url_patterns
    raise ImproperlyConfigured(msg.format(name=self.urlconf_name))
django.core.exceptions.ImproperlyConfigured: The included URLconf 'quiniela.urls' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.

My quiniela.urls looks like this:

from django.contrib import admin
from django.urls import path
from quinewhats.views import Home
from django.contrib.auth.views import LogoutView
from django.urls import include
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', Home.as_view()),
    path("logout/", LogoutView.as_view(), name="logout"),
    path('liga/',include('liga.urls',namespace='liga')),
]

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

And my liga.urls like this:

from django.urls import path
from .views import EquiposTableView,EquiposCreateView,EquiposUpdateView,EquiposDeleteView, LigaTableView, LigaCreateView, LigaUpdateView, LigaDeleteView, TorneosTableView,TorneosCreateView,TorneosDeleteView,TorneosUpdateView

app_name='liga'

urlpatterns = [
    path('equipos/table/', EquiposTableView.as_view(), name='tabla_equipos'),
    path('equipos/create/',EquiposCreateView.as_view(), name='crear_equipos'),
    path('equipos/update/<int:pk>/',EquiposUpdateView.as_view(), name='actualizar_equipos'),
    path('equipos/delete/<int:pk>/',EquiposDeleteView.as_view(), name='eliminar_equipos'),
    path('liga/table/', LigaTableView.as_view(), name='tabla_liga'),
    path('liga/create/', LigaCreateView.as_view(), name='crear_liga'),
    path('liga/update/<int:pk>/', LigaUpdateView.as_view(), name='actualizar_liga'),
    path('liga/delete/<int:pk>/', LigaDeleteView.as_view(), name='eliminar_liga'),

]

I don't know what a circular import is, but I read it could be that my urls.py was somewhat imported to a views.py, but I checked and it doesn't seem to be the case. Is there any other thing I'm overseeing, or some other information that could be useful? This has taken me longer than I hoped.

EDIT: This are the INSTALLED_APPS:

在此处输入图像描述

And this is the file structure:

在此处输入图像描述

不要提及视图方法前的括号:- EquiposCreateView.as_view() ----> EquiposCreateView.as_view

Go to your project folder url , there check your urlpatterns . Maybe you have forgotten to type like this,

urlpatterns = [
path("", include("your_app.urls")),
]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM