【发布时间】:2021-08-06 20:59:36
【问题描述】:
同事们好!我在 Django 项目中工作。我的网址有问题
在项目中我只有一个应用程序,我创建了我的 urls 文件,以便稍后将其导入到整个项目的 urls 中,但是当服务器运行时,它给了我以下错误:
The included URLconf 'online_store.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.
我的 urls.py 项目
from django.contrib import admin
from django.urls import path, include
urlspatterns = [
path('admin/', admin.site.urls),
path('', include('online_store_app.urls')),
]
还有我的应用程序 urls.py
# Dajngo
from django.urls import path
from online_store_app import views
urlspatterns = [
# urls site
path('home', views.home, name = 'home'),
path('services', views.services, name = 'services'),
path('store', views.store, name = 'store'),
path('blog', views.blog, name = 'blog'),
path('contact', views.contact, name = 'contact'),
]
【问题讨论】:
-
这是您在第一个文件开头的导入语句:from django.urls import include 吗?
标签: django django-urls django-apps