首页 > 解决方案 > 如何修复“配置不当”错误?

问题描述

刚开始学习 Django,但马上遇到了一个错误

我得到了错误:

django.core.exceptions.ImproperlyConfigured: The included URLconf '<module 'app.urls' from 
'C:\\django tutorial\\mysite\\app\\urls.py'>' 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.

这些是包含我的代码的文件:

视图.py:

from django.shortcuts import render 
from django.http import HttpResponse

def index(response):
 return HttpResponse('Tech with Adil')

应用程序.urls.py:

from django.urls import path from . import views 
urlpatters = [
     path("", views.index, name='index') ]

和 mysite.urls.py:

from django.contrib import admin

from django.urls import path, include 

urlpatterns = [
    path('', include('app.urls')),
    path('admin/', admin.site.urls) ]

标签: pythondjangoweb

解决方案


推荐阅读