django学习之一在浏览器上完美打印基础内容
django学习之一在浏览器上完美打印基础内容
1.创建一个工程项目:django-admin startproject project_name
2.为项目创建一个app:python manage.py startapp app_name 或 django-admin startapp app_name
3.创建或更改数据库表或字段:python manage.py makemigrations && python manage.py migrate
4.创建超级管理员:python manage.py createsuperuser
5.项目文件
5.编辑代码views.py
# -*- coding: utf-8 -*- from django.http import HttpResponse def index(request): return HttpResponse(u'<h1>欢迎来到陈建文的学习基地')
6.编辑代码urls.py
from django.conf.urls import url from django.contrib import admin from learn import views as learn_views urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$',learn_views.index) ]
7.运行项目:python.exe .\manage.py runserver 0.0.0.0:8000
8.查看成果
===================大功告成===================
===================QQ1071179133===================
一些事情一直在干,说不定以后就结果了呢
本文来自博客园,作者:chenjianwen,转载请注明原文链接:https://www.cnblogs.com/chenjw-note/articles/7219158.html