1、建立项目
django-admin startproject hello
2、创建app
django-admin startapp hello1
3、创建具体功能views
打印hello word!
from django.shortcuts import render
def hello(request):
return render(request, 'hello.html')
4、编写html模板
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>hello world!</title>
</head>
<body>
<h1 style="background-color: black;color: aquamarine">hello world!</h1>
</body>
5、编写urls
from django.conf.urls import url
from django.contrib import admin
from hello1 import views
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^$', views.hello, name='hello'),
]
6、启动服务器
python manage.py runserver