1、创建工程django-admin.py startproject devops
2、创建APP
qiangsh@Dream ~/D/P/5/Django_day1> cd devops/
qiangsh@Dream ~/D/P/5/D/devops> python manage.py startapp hello
qiangsh@Dream ~/D/P/5/D/devops> tree hello
hello
├── __init__.py
├── admin.py
├── apps.py
├── migrations
│ └── __init__.py
├── models.py
├── tests.py
└── views.py
1 directory, 7 files
3、全局配置文件中注册新创建的APP
$ cat devops/settings.py
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'hello.apps.HelloConfig',
]
4、编写处理逻辑代码(控制器)
$ cat hello/view.py
# Create your views here.
from django.http import HttpResponse
def index(request):
return HttpResponse("<p>Hello World,Hello, Django</p>")
5、