|
@@ -2,33 +2,34 @@ |
|
|
# -*- coding: utf-8 -*- |
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
|
|
|
from time import asctime |
|
|
from time import asctime |
|
|
from logging import DEBUG, FileHandler |
|
|
|
|
|
|
|
|
from logging import DEBUG, TimedRotatingFileHandler |
|
|
|
|
|
|
|
|
from flask import Flask, request |
|
|
from flask import Flask, request |
|
|
from flask.ext.mako import render_template |
|
|
from flask.ext.mako import render_template |
|
|
from flup.server.fcgi import WSGIServer |
|
|
from flup.server.fcgi import WSGIServer |
|
|
|
|
|
|
|
|
app = Flask(__name__, static_folder="static", static_url_path="/copyvios/static") |
|
|
|
|
|
|
|
|
app = Flask(__name__) |
|
|
|
|
|
|
|
|
logger = FileHandler("error.log") |
|
|
|
|
|
app.logger.setLevel(DEBUG) |
|
|
app.logger.setLevel(DEBUG) |
|
|
app.logger.addHandler(logger) |
|
|
|
|
|
|
|
|
app.logger.addHandler(TimedRotatingFileHandler("logs/app.log", when="D", |
|
|
|
|
|
interval=1, backupCount=7)) |
|
|
app.logger.info(u"Flask server started " + asctime()) |
|
|
app.logger.info(u"Flask server started " + asctime()) |
|
|
|
|
|
|
|
|
@app.after_request |
|
|
@app.after_request |
|
|
def write_access_log(response): |
|
|
def write_access_log(response): |
|
|
app.logger.debug(u"%s %s -> %s" % (asctime(), request.path, response.status_code)) |
|
|
|
|
|
|
|
|
msg = u"%s %s -> %s" |
|
|
|
|
|
app.logger.debug(msg, asctime(), request.path, response.status_code) |
|
|
return response |
|
|
return response |
|
|
|
|
|
|
|
|
@app.route("/copyvios") |
|
|
|
|
|
|
|
|
@app.route("/") |
|
|
def index(): |
|
|
def index(): |
|
|
return render_template("index.mako") |
|
|
return render_template("index.mako") |
|
|
|
|
|
|
|
|
@app.route("/copyvios/settings") |
|
|
|
|
|
|
|
|
@app.route("/settings") |
|
|
def settings(): |
|
|
def settings(): |
|
|
return render_template("settings.mako") |
|
|
return render_template("settings.mako") |
|
|
|
|
|
|
|
|
@app.route("/copyvios/debug") |
|
|
|
|
|
|
|
|
@app.route("/debug") |
|
|
def debug(): |
|
|
def debug(): |
|
|
return render_template("debug.mako") |
|
|
return render_template("debug.mako") |
|
|
|
|
|
|
|
|