最小的Django应用
Posted 天际凯迪
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了最小的Django应用相关的知识,希望对你有一定的参考价值。
创建一个hello.py 内容如下:
import sys from django.conf import settings # 设置 settings.configure( DEBUG = True, SECRET_KEY = ‘thisisthe‘, ROOT_URLCONF = __name__, MIDDLEWARE_CLASSES = ( ‘django.middleware.common.CommonMiddleware‘, ‘django.middleware.csrf.CsrfViewMiddleware‘, ‘django.middleware.clickjacking.XFrameOptionsMiddleware‘, ), ) from django.conf.urls import url from django.http import HttpResponse # 创建视图 def index(request): return HttpResponse("Hello world") # URL urlpatterns = ( url(r‘^$‘, index), ) if __name__ == "__main__": from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
终端运行:python hello.py runserver
System check identified no issues (0 silenced).
Django version 2.0.3, using settings None
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
以上是关于最小的Django应用的主要内容,如果未能解决你的问题,请参考以下文章
django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE的解决办法(转)(代码片段
django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE的解决办法(转)(代码片段