最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - Django error : django.core.exceptions.ImproperlyConfigured: - Stack Overflow

programmeradmin1浏览0评论

I get the following error all the time since two days now and i am stacked at this level.This the error:

django.core.exceptions.ImproperlyConfigured: The included URLconf '<module 'pages.urls' from 'C:\\Users\\adech\\mon_site\\monsite\\pages\\urls.py'>' does not appear to have any patterns in it. If you see the 'urlpatterns' variable with valid patterns in the file then the issue is probably caused by a circular import.

I am a beginner with django and i read the django documentation following all the instructions but always the same problem.

Un extrait du code dans urls de mon site:

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
      path('admin/', admin.site.urls),
      path('', include('pages.urls')),
      path('services/', include('services.urls')),
      path('portfolio/', include('portfolio.urls')),
      path('contact/', include('contact.urls')),
      ]

un extrait du code dans settings :

    INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'pages',      # Application pour la gestion des pages (Accueil, À propos)
    'services',   # Application pour les services
    'portfolio',  # Application pour les projets et le portfolio
    'contact',    # Application pour le formulaire de contact
]

le code dans mon app page.urls

from django.urls import path
from . import views

urlpatterns = [
path('', views.home, name='home'),  
]

Le code dans views de mon app pages:

from django.shortcuts import render

def home(request):
    return render(request, 'pages/home.html')
发布评论

评论列表(0)

  1. 暂无评论