Changeset - 1492de7d9826
[Not reviewed]
default
0 2 1
Dennis Fink - 10 years ago 2015-07-08 23:07:21

use flask_bootstrap
3 files changed with 33 insertions and 4 deletions:
0 comments (0 inline, 0 general)
spaceapi/__init__.py
Show inline comments
 
@@ -4,8 +4,10 @@ import os.path
 
import base64
 

	
 
from flask import Flask
 
from flask_bootstrap import Bootstrap
 

	
 
config_file = os.path.abspath('config.json')
 
bootstrap = Bootstrap()
 

	
 

	
 
def create_app():
 
@@ -34,6 +36,9 @@ def create_app():
 
        app.config.from_json = from_json
 

	
 
    app.config.from_json(config_file, silent=True)
 
    app.config.setdefault('BOOTSTRAP_SERVE_LOCAL', True)
 

	
 
    bootstrap.init_app(app)
 

	
 
    @app.after_request
 
    def add_headers(response):
spaceapi/templates/base.html
Show inline comments
 
new file 100644
 
{% extends "bootstrap/base.html" %}
 

	
 
{% block metas %}
 
  {{ super() }}
 
  <meta charset="utf-8">
 
  <meta name="application-name" content="c3l_spaceapi">
 
{% endblock %}
 

	
 
{% block body %}
 
  <div class="container">
 
    {% block navbar %}
 
    {% endblock %}
 
    <div class="row" id="content">
 
      <div class="col-md-12">
 
        {% block content %}
 
        {% endblock %}
 
      </div>
 
    </div>
 
    <div class="footer" id="main_footer">
 
      {% block footer %}
 
      {% endblock %}
 
    </div>
 
  </div>
 
{% endblock %}
spaceapi/templates/index.html
Show inline comments
 
<html>
 
  <body>
 
{% extends "base.html" %}
 

	
 
{% block content %}
 
    {% if status['state']['open'] %}
 
      <img src="{{ url_for('static', filename='open.png') }}"></img>
 
      <p>Yes, we're open!</p>
 
@@ -7,5 +8,4 @@
 
      <img src="{{ url_for('static', filename='closed.png') }}"></img>
 
      <p>Sorry, we're closed!</p>
 
    {% endif %}
 
  </body>
 
</html>
 
{% endblock %}
0 comments (0 inline, 0 general)