zoukankan      html  css  js  c++  java
  • django2.0 报错 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.

    raise ImproperlyConfigured(msg.format(name=self.urlconf_name))
    django.core.exceptions.ImproperlyConfigured: 
    The included URLconf
    '<module 'users.urls' from 'D:\mygitfile\meiduo_project\meiduo_mall\meiduo_mall\apps\users\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.

    错误来源:配置子应用的url时,启动django项目报错

    错误原因:启动django项目,django框架会加载路由配置,如果在总路由添加了子应用,

    那么需要在子应用文件下新建一个urls.py文件 并且要加上 urlpatterns=[]

    例如:主应用 url.py

    """meiduo_mall URL Configuration
    
    The `urlpatterns` list routes URLs to views. For more information please see:
        https://docs.djangoproject.com/en/2.0/topics/http/urls/
    Examples:
    Function views
        1. Add an import:  from my_app import views
        2. Add a URL to urlpatterns:  path('', views.home, name='home')
    Class-based views
        1. Add an import:  from other_app.views import Home
        2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
    Including another URLconf
        1. Import the include() function: from django.urls import include, path
        2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
    """
    from django.contrib import admin
    from django.urls import include, path
    
    urlpatterns = [
        path('admin/', admin.site.urls),
        path('users/', include(('users.urls', 'users'), namespace='users')),
    ]

    子应用urls.py

    from django.urls import path
    from . import views
    
    urlpatterns=[
        path('register/',views.RegisterView.as_view(),name='register')
    ]
    坚持,坚持,坚持…… 在你选择不放弃的那一刻, 成功其实已经在向你走近 我们无法得知什么时候会来临 但我们可以选择用自强的双手敲开幸福的门。
  • 相关阅读:
    UML中的构件图
    Extjs4 中的gird
    【转载】C#实现线程安全的网络流
    [转载]组播
    【转载】wcf综合运用之:大文件异步断点续传
    【转载】WCF热门问题编程示例(4):WCF客户端如何异步调用WCF服务?
    【转载】特殊用途的IP地址介绍
    [转载]C# HashTable
    c宏定义实战
    c异或加密与解密
  • 原文地址:https://www.cnblogs.com/bronyaa/p/14510395.html
Copyright © 2011-2022 走看看