This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def bigFileView(request): | |
u"""在Django中提供大内容(或大文件)下载 | |
@see http://oldj.net/article/django-big-file-response/ | |
""" | |
# do something... | |
def readFile(fn, buf_size=262144): | |
f = open(fn, "rb") | |
while True: | |
c = f.read(buf_size) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# | |
# Author: oldj | |
# Email: [email protected] | |
# Blog: http://oldj.net | |
# | |
import os | |
import re | |
import StringIO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**//**//**//**//**//**//* | |
** ================================================================================================== | |
** 类名:J.gbk | |
** 版本:1.0 | |
** 功能:URLEncode,URLDecode | |
** 示例: | |
--------------------------------------------------------------------------------------------------- | |
用法:参见组件地址 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
name = socket.gethostname() | |
ip_addr = socket.gethostbyname(name) | |
print name | |
print ip_addr |
NewerOlder