文件操作 - fileserve_async.py
返回文件管理
返回主菜单
删除本文件
文件: /usr/share/doc/uwsgi-core/tests/fileserve_async.py
编辑文件内容
import sys import mimetypes basedir = sys.argv[1] mimetypes.init() def application(environ, start_response): filename = basedir + environ['PATH_INFO'] (content_type, encoding) = mimetypes.guess_type(filename) if not content_type: content_type = 'text/plain' start_response('200 OK', [('Content-Type', content_type)]) fd = open(filename,'r') yield environ['wsgi.file_wrapper'](fd, 32*1024)
修改文件时间
将文件时间修改为当前时间的前一年
删除文件