python——template (一)
来源:互联网 发布:手机怎么变成2g网络了 编辑:程序博客网 时间:2024/06/06 07:06
1.文件说明 settings.py:Generated by ‘django-admin startproject’ using Django 1.9.6.
2.# Build paths inside the project like this: os.path.join(BASE_DIR, …)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(file)))
3.TEMPLATES = [
{
‘BACKEND’: ‘django.template.backends.django.DjangoTemplates’,
‘DIRS’: [os.path.join(BASE_DIR, “templates”)],
‘APP_DIRS’: True,
‘OPTIONS’: {
‘context_processors’: [
‘django.template.context_processors.debug’,
‘django.template.context_processors.request’,
‘django.contrib.auth.context_processors.auth’,
‘django.contrib.messages.context_processors.messages’,
], },
]
注: 'DIRS': [os.path.join(BASE_DIR, "templates")],join函数的用法需要理解,是将几个字符串拼接成一个路径。是变长参数列表,一级一级拼接。参数值给错会提示找不到模块。
4.views.py文件
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def hello(request):
return render(request,’tomorrow.html’)
- python——template (一)
- python template
- python Template
- Android框架设计模式(一)——Template Methods
- C++ template ——function template
- Python Template Demo
- python string Template
- nagios python template
- [笔记]python template 模板
- python的Template使用指南
- Python:Template使用指南
- python的Template使用指南
- C++复习——template,template类,memcmp
- Henry手记—使用Template Method设计模式的.NET事件处理机制(一)
- design pattern——template
- C++ Template(一)
- template模板一
- js中的template — Jemplate
- c语言实现回调函数
- PostgreSQL 常用操作
- 算法 剑指Offer 面试题32 从1到n整数中1出现的次数
- awk 命令
- java servlet实现上传文件代码及其原理说明
- python——template (一)
- JAVA之旅(十三)——线程的安全性,synchronized关键字,多线程同步代码块,同步函数,同步函数的锁是this
- iOS学习- 15 Edit tableview item - Todo App
- 第一篇博文
- 相似图片搜索、算法、识别的原理解析(上)
- React 组件之间如何交流
- Ubuntu 12.04 下 android studio 安装 和 配置
- MySQL 服务无法启动。 服务没有报告任何错误。 请键入 NET HELPMSG 3534 以获得更多的帮助。
- 【AS导包】Android Studio 导入第三方jar包