From f9052ee80da3c7905c9fd9d8e2ffb1dcbf8d848e Mon Sep 17 00:00:00 2001 From: Carlos Vieira Date: Tue, 13 May 2014 10:12:34 -0300 Subject: [PATCH] barrabrasil.py: corre??o da fonte. build.sh: modifica??o na data. profile.py: adicionando profiling --- LEIAME | 5 +++++ app/barrabrasil.py | 14 +------------- app/profile | 2 +- app/profile.py | 7 +++++++ build.sh | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) create mode 100644 app/profile.py diff --git a/LEIAME b/LEIAME index 65db707..181ab92 100644 --- a/LEIAME +++ b/LEIAME @@ -32,6 +32,11 @@ Dependências: # sass -v - uglifyjs # sudo npm install -g uglify-js + - zlib + +Para profiling é necessário além dos acima + + - werkzeug Requisitos da Barra diff --git a/app/barrabrasil.py b/app/barrabrasil.py index 94bd75b..6ad9dfd 100644 --- a/app/barrabrasil.py +++ b/app/barrabrasil.py @@ -54,23 +54,11 @@ def barra(): resposta = make_response(conteudo) resposta.set_etag(etag) resposta.headers['Content-type'] = 'application/x-javascript' - resposta.headers['Cache-control'] = 'public, max-age: 86401' #24 horas - resposta.headers['Last-Modified'] = data - return resposta - -@app.route('/static/opensans-bold.woff') -def fonte(): - f = app.open_resource('profile') - cfg = Config(f) - data = cfg.date - f = app.open_resource('static/opensans-bold.woff') - conteudo = f.read().decode('base64') - resposta = make_response(conteudo) - resposta.headers['Content-type'] = 'application/x-font-woff' resposta.headers['Cache-control'] = 'public, max-age: 31536000' #1 ano resposta.headers['Last-Modified'] = data return resposta + if __name__ == '__main__': import webbrowser webbrowser.open("http://127.0.0.1:5000/",new=2) diff --git a/app/profile b/app/profile index a1a29bb..2c99da2 100644 --- a/app/profile +++ b/app/profile @@ -1,2 +1,2 @@ profile : copa2014 -date : " Mon, 12 May 2014 15:52:03 -0300 " +date : "Tue, 13 May 2014 09:23:53 -0300" diff --git a/app/profile.py b/app/profile.py new file mode 100644 index 0000000..82a13ee --- /dev/null +++ b/app/profile.py @@ -0,0 +1,7 @@ +#!flask/bin/python +from werkzeug.contrib.profiler import ProfilerMiddleware +from barrabrasil import app + +app.config['PROFILE'] = True +app.wsgi_app = ProfilerMiddleware(app.wsgi_app, restrictions = [30]) #30 que mais demoraram +app.run(debug = True) diff --git a/build.sh b/build.sh index 9bc4526..e26652b 100755 --- a/build.sh +++ b/build.sh @@ -14,7 +14,7 @@ then cd ../../app touch profile echo 'profile :' $profile > profile - echo 'date : "' $(date -R) '"'>> profile + echo 'date : "'$(date -R)'"'>> profile python barrabrasil.py else echo "Error. Profile $1 does not exist." -- libgit2 0.21.2