Commit f9052ee80da3c7905c9fd9d8e2ffb1dcbf8d848e

Authored by Carlos Vieira
1 parent e81a9130
Exists in master

barrabrasil.py: corre??o da fonte. build.sh: modifica??o na data. profile.py: adicionando profiling

LEIAME
... ... @@ -32,6 +32,11 @@ Dependências:
32 32 # sass -v
33 33 - uglifyjs
34 34 # sudo npm install -g uglify-js
  35 + - zlib
  36 +
  37 +Para profiling é necessário além dos acima
  38 +
  39 + - werkzeug
35 40  
36 41 Requisitos da Barra
37 42  
... ...
app/barrabrasil.py
... ... @@ -54,23 +54,11 @@ def barra():
54 54 resposta = make_response(conteudo)
55 55 resposta.set_etag(etag)
56 56 resposta.headers['Content-type'] = 'application/x-javascript'
57   - resposta.headers['Cache-control'] = 'public, max-age: 86401' #24 horas
58   - resposta.headers['Last-Modified'] = data
59   - return resposta
60   -
61   -@app.route('/static/opensans-bold.woff')
62   -def fonte():
63   - f = app.open_resource('profile')
64   - cfg = Config(f)
65   - data = cfg.date
66   - f = app.open_resource('static/opensans-bold.woff')
67   - conteudo = f.read().decode('base64')
68   - resposta = make_response(conteudo)
69   - resposta.headers['Content-type'] = 'application/x-font-woff'
70 57 resposta.headers['Cache-control'] = 'public, max-age: 31536000' #1 ano
71 58 resposta.headers['Last-Modified'] = data
72 59 return resposta
73 60  
  61 +
74 62 if __name__ == '__main__':
75 63 import webbrowser
76 64 webbrowser.open("http://127.0.0.1:5000/",new=2)
... ...
app/profile
1 1 profile : copa2014
2   -date : " Mon, 12 May 2014 15:52:03 -0300 "
  2 +date : "Tue, 13 May 2014 09:23:53 -0300"
... ...
app/profile.py 0 → 100644
... ... @@ -0,0 +1,7 @@
  1 +#!flask/bin/python
  2 +from werkzeug.contrib.profiler import ProfilerMiddleware
  3 +from barrabrasil import app
  4 +
  5 +app.config['PROFILE'] = True
  6 +app.wsgi_app = ProfilerMiddleware(app.wsgi_app, restrictions = [30]) #30 que mais demoraram
  7 +app.run(debug = True)
... ...
build.sh
... ... @@ -14,7 +14,7 @@ then
14 14 cd ../../app
15 15 touch profile
16 16 echo 'profile :' $profile > profile
17   - echo 'date : "' $(date -R) '"'>> profile
  17 + echo 'date : "'$(date -R)'"'>> profile
18 18 python barrabrasil.py
19 19 else
20 20 echo "Error. Profile $1 does not exist."
... ...