Python Flask FrameWork =============================== ******************************************************************************** ## downloadchibashi.py ******************************************************************************** import logging from logging.handlers import RotatingFileHandler from flask import Flask from flask import send_from_directory import urllib import urllib2 #from BeautifulSoup import BeautifulSoup import re app = Flask(__name__, static_folder='static') @app.route('/') def root(): return ':D :) Hello World!' @app.route('/uploads/') def download_file(filename): #return send_from_directory(app.config['UPLOAD_FOLDER'],filename, as_attachment=True) print app.static_folder return send_from_directory(app.static_folder,filename, as_attachment=True) if __name__ == '__main__': handler = RotatingFileHandler('foo.log', maxBytes=10000, backupCount=1) handler.setLevel(logging.INFO) app.logger.addHandler(handler) app.run(debug=True) ******************************************************************************** ## downloadchibashi.wsgi ******************************************************************************** from downloadchibashi import app as application import sys sys.stdout = sys.stderr ******************************************************************************** ## downloadchibashi.conf ******************************************************************************** ServerName downloadchibashi.com ServerAlias www.downloadchibashi.com ServerAdmin webmaster@localhost WSGIDaemonProcess downloadchibashi user=farid gro up=farid threads=5 python-path=/home/farid/htdocs/downloadchibashi/ WSGIScriptAlias / /home/farid/htdocs/downloadchibashi/downloadchibashi.wsgi DocumentRoot /home/farid/htdocs/downloadchibashi/static WSGIProcessGroup downloadchibashi WSGIApplicationGroup %{GLOBAL} Order deny,allow Require all granted ErrorLog ${APACHE_LOG_DIR}/downloadchibashi_error.log CustomLog ${APACHE_LOG_DIR}/downloadchibashi_access.log combined _BY: Farid Ahmadian_ _TAG: python, flask, apache_ _DATE: 2015-01-27 19:36:53_