简体   繁体   中英

I continue getting an error whenever I run my Django program

I started building an application using Django but whenever I run it I always get this error message.

django.core.exceptions.ImproperlyConfigured: The included URLconf '' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is p robably caused by a circular import.

I currently have three files:

mysite/urls.py :

from django.conf.urls import url, include
from django.contrib import admin

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^account/', include('accounts.urls'))

accounts/urls.py :

from django.conf.urls import url
from . import views

urlpatterns = [
    url(r'^$', views.home),
]

and views.py :

from django.shortcuts import render, HttpResponse

def home(request):
    return HttpResponse('Home page')

This should theoretically print "Home page" on my ip but the error message continues arising in cmd when I run : python manage.py runserver 127.0.0.1:8080 (I cd'd it too)

This is a simplified version of my hierarchy:

Mysite
  accounts
    urls.py
    views.py
  mysite
    urls.py

I have been following a tutorial and checked that everything is correct.

Can someone help me find a solution? (Please don't beat me up if I messed something very obvious up. I am new and quite inexperienced)

Just a typo:

try changing urlpatters to urlpatterns in your "accounts/urls.py".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM