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

猜你喜欢

转载自www.cnblogs.com/ht1947/p/9262243.html
今日推荐