Commit 9e289bb697b2e55f6b7681c40e827232ad0d15bb

Authored by carlos.vieira
1 parent be50999f
Exists in master

barrabrasil.py: corrigindo a rota do barra.js utilizando o config. README: adici…

…onado referencia a nova configura??o
Showing 2 changed files with 11 additions and 5 deletions   Show diff stats
LEIAME
... ... @@ -2,6 +2,11 @@ Projeto Barra Brasil Distribuída - Desenvolvimento
2 2  
3 3 Como instalar
4 4  
  5 +Mudando o profile
  6 +
  7 + Altere o arquivo 'app/profile' para apontar para o novo profile
  8 + Exemplo: profile : copa2014
  9 +
5 10 Dependências:
6 11  
7 12  
... ...
app/barrabrasil.py
1 1 from flask import Flask, url_for, render_template, request, Response, make_response
2 2 from config import Config
3   -import hashlib#,webbrowser
  3 +import hashlib
4 4  
5 5 # Criar Key e certificado
6 6 # openssl genrsa 1024 > ssl.key
... ... @@ -26,6 +26,9 @@ def pagina_teste():
26 26  
27 27 @app.route('/barra.js')
28 28 def barra():
  29 + f = file('profile')
  30 + cfg = Config(f)
  31 + profile = cfg.profile
29 32 with app.open_resource('templates/%s/barra-brasil.js' % profile) as f:
30 33 conteudo = f.read().decode('utf-8')
31 34 etag = hashlib.sha1(conteudo.encode('utf-8')).hexdigest()
... ... @@ -40,10 +43,8 @@ def barra():
40 43 return resposta
41 44  
42 45 if __name__ == '__main__':
43   - f = file('profile')
44   - cfg = Config(f)
45   - profile = cfg.profile
46   - #webbrowser.open("http://127.0.0.1:5000/",new=2)
  46 + import webbrowser
  47 + webbrowser.open("http://127.0.0.1:5000/",new=2)
47 48 app.run(debug=False)
48 49 #webbrowser.open("https://127.0.0.1:5000/",new=2)
49 50 #app.run(debug=False,ssl_context=ctx)
... ...