我想创建一个Django你好世界应用程序。服务器不启动你好世界应用程序
我有以下代码:
import sys
from django.conf import settings
from django.http import HttpResponse
settings.configure(
DEBUG=True,
SECRET_KEY='badkey',
ROOT_URLCONF=sys.modules[__name__],
)
def index(request):
return HttpResponse('Hello, World')
urlpatterns = [
(r'^hello-world/$', index),
]
位于/smartQuiz/smartQuiz/hello.py
,其中smartQuiz
是我的项目的根目录。
如果我从hello.py
所在的目录运行python hello.py runserver
,服务器将无法启动。
我在做什么错?
你会得到什么错误? – jape
这真的不是你如何运行Django。是什么让你认识到这会起作用? –
我没有收到任何错误。我没有收到任何消息。我在这里看:https://ultimatedjango.com/learn-django/lessons/create-the-hello-world-web-app/ – octavian