import csv from datetime import timedelta def download_csv(commend=None): response = HttpResponse(content_type='text/csv') response['Content-Dispositi... ...
分类:
其他好文 时间:
2017-11-28 15:31:02
阅读次数:
214
cookie :客户端浏览器上的一个文件,用键值对的方式存储在文件中。在服务器端和客户端都可以对其进行设置和获取。利用这一特性,可以对用户进行登录认证,设置分页.... 服务器端: 在views.py中: 设置 rep = HttpResponse(...) 或 rep = render(reque ...
分类:
其他好文 时间:
2017-11-21 23:58:59
阅读次数:
375
在上一章节中我们使用 django.http.HttpResponse() 来输出 "Hello World!"。该方式将数据与视图混合在一起,不符合 Django 的 MVC 思想。 本章节我们将为大家详细介绍 Django 模板的应用,模板是一个文本,用于分离文档的表现形式和内容。 模板应用实例 ...
分类:
其他好文 时间:
2017-11-20 14:33:00
阅读次数:
137
使用HttpClient获取网页内容的过程 1、创建一个CloseableHttpClient类的实例; 2、使用这个实例执行HTTP请求,得到一个HttpResponse的实例; 3、最后,通过HttpResponse的实例得到返回的二进制流,二进制流封装在HttpEntity中。根据指定的字符集 ...
分类:
其他好文 时间:
2017-11-13 13:59:59
阅读次数:
183
os
json
datetimedatetime
django.httpHttpResponse
re
elasticsearchElasticsearch
es=Elasticsearch(
[]=)
res8=es.search(
==={
:{
:{
:{
::}
}
}
}
)
statistic():
():
hitres8[][]:
a=(%hit+%hit[])
a=re.split(a);
a
rowa:
id=row[]
=row[]
id
HttpResponse(a)
分类:
编程语言 时间:
2017-11-08 10:32:59
阅读次数:
189
请求周期: url > 路由 > 函数或类 > 返回字符串或模板语言 Form 表单提交: 先处理模板语言再讲HTML发出去 提交 > url > 函数或类中的方法 ———— - httpResponse() | render(request) | redirect('/index') | 用户 < ...
分类:
其他好文 时间:
2017-11-05 11:25:11
阅读次数:
181
普同查询: 双下划线的使用 1 from django.shortcuts import render,HttpResponse 2 3 # Create your views here. 4 from app01 import models 5 6 def query(request): 7 # ...
分类:
其他好文 时间:
2017-11-04 16:27:57
阅读次数:
144
这是url反向解析的另一种形式: from django.shortcuts import render,redirect,HttpResponse from django.conf import settings # Create your views here. from app01 impor ...
分类:
其他好文 时间:
2017-11-04 00:07:13
阅读次数:
128
在上一章节中我们使用 django.http.HttpResponse() 来输出 " meishiweb!"。该方式将数据与视图混合在一起,不符合 Django 的 MTV 思想。 下面我们将为大家详细介绍 Django 模板的应用,模板是一个文本,用于分离文档的表现形式和内容。 ...
分类:
其他好文 时间:
2017-11-03 12:52:55
阅读次数:
141
Django数据增删改查: 上课代码 views from django.shortcuts import render, HttpResponse from app01 import models # Create your views here. def addBook(request): # ...
分类:
其他好文 时间:
2017-10-27 20:33:45
阅读次数:
140