windows 7 x64
目前成都創(chuàng)新互聯(lián)公司已為近1000家的企業(yè)提供了網(wǎng)站建設(shè)、域名、虛擬空間、綿陽服務(wù)器托管、企業(yè)網(wǎng)站設(shè)計、合川網(wǎng)站維護等服務(wù),公司將堅持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長,共同發(fā)展。IIS 6
python 2.7.9
wfastcgi-3.0.0
flask-0.12.2
pip install wfastcgi
C:\Users\wangpan>D:\software\Python27\Scripts\wfastcgi-enable.exe
已經(jīng)在配置提交路徑“MACHINE/WEBROOT/APPHOST”向“MACHINE/WEBROOT/APPHOST”的“system.webServer/fastCgi”節(jié)應(yīng)用了配置更改
“d:\software\python27\python.exe|d:\software\python27\lib\site-packages\wfastcgi.pyc” can now be used as a FastCGI script processor
pip install flask
IIS 需要安裝 URL 重寫組件,這個可以通過Microsoft Web Platform Installer來安裝。下載Microsoft Web Platform Installer后運行,搜索URL,安裝URL重寫工具。
upload
–static上傳目錄的靜態(tài)文件目錄
–upload.py上傳文件程序
–web.config配置文件
注意:
scriptProcessor的內(nèi)容是執(zhí)行wfastcgi-enable的輸出
WSGI_HANDLER的value
PYTHONPATH的value
WSGI_LOG的目錄一定要存在
#_*_coding:utf-8_*_ import os from flask import Flask, request, redirect, url_for,render_template from werkzeug import secure_filename from flask import send_from_directory UPLOAD_FOLDER = 'd:\data\mysite\upload\static' ALLOWED_EXTENSIONS = set(['txt', 'docx', 'doc', 'xlsx' , 'xls','ppt' , 'pdf', 'png', 'jpg', 'jpeg', 'gif']) app = Flask(__name__) app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER def allowed_file(filename): return '.' in filename and \ filename.rsplit('.', 1)[1] in ALLOWED_EXTENSIONS @app.route('/', methods=['GET', 'POST']) def upload_file(): if request.method == 'POST': file = request.files['file'] filename = file.filename if file and allowed_file(filename): #filename = secure_filename(file.filename) file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename)) return redirect(url_for('uploaded_file',filename=filename)) #return redirect('success.html') return '''Upload new File Upload new File
http://docs.jinkan.org/docs/flask/
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。