python - 如何修复“配置不当”错误?
问题描述
刚开始学习 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) ]
解决方案
推荐阅读
- node.js - Angular CLI 项目编译失败
- angularjs - SSO 中继状态问题
- c# - 通过 Asp.net Core 在 Angular 中显示 Stimulsoft 报告
- jenkins - 添加更多 PR 状态检查(Jenkins 蓝海,与 github 集成)
- android - Kotlin 中的接口作为函数
- css - SemanticUI 输入大于列
- html - HTML 的最佳实践?如何通过提交删除表条目?
- javascript - 通过比较两个组合框中的两个值来获取文本框的值
- microsoft-graph-api - Microsoft-Teams 通过 Graph API 获取所有消息通道及其回复
- aws-lambda - Lambda 函数在 DynamoDB 事件上触发了两次