A copyright violation detector running on Wikimedia Cloud Services https://tools.wmflabs.org/copyvios/
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 

45 righe
1.3 KiB

  1. #! /data/project/copyvios/env/bin/python
  2. # -*- coding: utf-8 -*-
  3. from time import asctime
  4. from logging import DEBUG
  5. from logging.handlers import TimedRotatingFileHandler
  6. from flask import Flask, request
  7. from flask.ext.mako import MakoTemplates, render_template
  8. from flup.server.fcgi import WSGIServer
  9. from copyvios.cookies import parse_cookies
  10. app = Flask(__name__)
  11. MakoTemplates(app)
  12. app.logger.setLevel(DEBUG)
  13. app.logger.addHandler(TimedRotatingFileHandler("logs/app.log", when="D",
  14. interval=1, backupCount=7))
  15. app.logger.info(u"Flask server started " + asctime())
  16. @app.after_request
  17. def write_access_log(response):
  18. msg = u"%s %s -> %s"
  19. app.logger.debug(msg, asctime(), request.path, response.status_code)
  20. return response
  21. @app.route("/")
  22. def index():
  23. cookies = parse_cookies(request.environ)
  24. return render_template("index.mako", environ=request.environ, cookies=cookies)
  25. @app.route("/settings")
  26. def settings():
  27. cookies = parse_cookies(request.environ)
  28. return render_template("settings.mako", environ=request.environ, cookies=cookies)
  29. @app.route("/debug")
  30. def debug():
  31. cookies = parse_cookies(request.environ)
  32. return render_template("debug.mako", environ=request.environ, cookies=cookies)
  33. if __name__ == '__main__':
  34. WSGIServer(app).run()