Django версия = 1.11
Версия Python = 3.6.5
Калани - папка проекта
testapp - это папка приложения
Я думаю, что моя проблема в urls.py.
http://127.0.0.1:8000/hello
Сообщение об ошибке:
ERROR:
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/hello
Using the URLconf defined in kalani.urls, Django tried these URL
patterns, in this order:
^admin/
The current path, hello, didn't match any of these.
You're seeing this error because you have DEBUG = True in your Django
settings file. Change that to False, and Django will display a standard
404 page
TestApp / views.py:
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def hello(request):
return HttpResponse('<h1>Hello world</h1>')
Kalani / urls.py:
from django.conf.urls import url
from django.contrib import admin
from testapp import views
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^hello/', views.hello)
]
Kalani / settings.py
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'testapp'
]