django的hello world
Posted ht1947
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了django的hello world相关的知识,希望对你有一定的参考价值。
==================hello.py=================================
import sys
from django.conf import settings
from django.http import HttpResponse
from django.conf.urls import url
from django.core.management import execute_from_command_line
settings.configure(
DEBUG=True,
SECRET_KEY=‘onlyfortest‘,
ROOT_URLCONF=name,
)
def index(request):
return HttpResponse(‘Hello World‘)
urlpatterns = (
url(‘^$‘, index),
)
if name == "main":
execute_from_command_line(sys.argv)
========================================================
运行命令:
python hello.py runserver
以上是关于django的hello world的主要内容,如果未能解决你的问题,请参考以下文章