gzip responses

This commit is contained in:
tdurieux
2019-05-13 12:08:29 +01:00
parent 740c682f8e
commit 45968a631d
2 changed files with 3 additions and 1 deletions

View File

@@ -1,2 +1,3 @@
flask
pygithub
Flask-gzip

View File

@@ -15,6 +15,7 @@ from datetime import datetime
# non standards, in requirements.txt
from flask import Flask, request, Markup, render_template, redirect, url_for, send_from_directory
from flask_gzip import Gzip
import github
@@ -88,6 +89,7 @@ class Anonymous_Github:
def create_flask_application(self):
application = Flask(__name__)
gzip = Gzip(application)
application.log = {}
application.killurl = str(uuid.uuid4())
application.jinja_env.add_extension('jinja2.ext.do')
@@ -395,7 +397,6 @@ class Anonymous_Github:
cache_path = os.path.join(self.config_dir, id, "cache")
if os.path.isfile(os.path.join(cache_path, path)):
print("here", path)
return send_from_directory(os.path.dirname(os.path.join(cache_path, path)),
os.path.basename(os.path.join(cache_path, path)),
mimetype=get_type_content(path, path, repository_configuration, g_repo, is_website(path, repository_configuration, g_repo)).replace("; charset=utf-8", ""))