Moved the templates into the app directory.

Added Manager to the app.py
This commit is contained in:
Rebecca Law
2015-11-23 16:07:19 +00:00
parent ba14e1263b
commit 11d79951f3
89 changed files with 10356 additions and 24 deletions
+19 -22
View File
@@ -1,15 +1,20 @@
import os import os
from flask import Flask, render_template from flask import Flask, render_template
from flask.ext import assets from flask.ext import assets
from flask.ext.script import Manager, Server
from webassets.filter import get_filter from webassets.filter import get_filter
from app import create_app
app = Flask(__name__) application = create_app()
manager = Manager(application)
port = int(os.environ.get('PORT', 6012))
manager.add_command("runserver", Server(host='0.0.0.0', port=port))
# debug mode - switch to False for production # debug mode - switch to False for production
app.config['ASSETS_DEBUG'] = True application.config['ASSETS_DEBUG'] = True
application.config['DEBUG'] = True
env = assets.Environment(app) env = assets.Environment(application)
# debug mode - switch to True for production # debug mode - switch to True for production
env.config['cache'] = False env.config['cache'] = False
@@ -17,10 +22,10 @@ env.config['manifest'] = False
# Tell flask-assets where to look for our sass files. # Tell flask-assets where to look for our sass files.
env.load_path = [ env.load_path = [
os.path.join(os.path.dirname(__file__), 'assets/stylesheets'), os.path.join(os.path.dirname(__file__), 'app/assets/stylesheets'),
os.path.join(os.path.dirname(__file__), 'assets'), os.path.join(os.path.dirname(__file__), 'app/assets'),
os.path.join(os.path.dirname(__file__), 'assets/stylesheets/stylesheets/govuk_frontend_toolkit'), os.path.join(os.path.dirname(__file__), 'app/assets/stylesheets/stylesheets/govuk_frontend_toolkit'),
os.path.join(os.path.dirname(__file__), 'assets/stylesheets/govuk_template') os.path.join(os.path.dirname(__file__), 'app/assets/stylesheets/govuk_template')
] ]
@@ -82,20 +87,12 @@ env.register(
) )
@app.route("/") @manager.command
def index(): def list_routes():
return render_template('index.html') """List URLs of all application routes."""
for rule in sorted(application.url_map.iter_rules(), key=lambda r: r.rule):
print("{:10} {}".format(", ".join(rule.methods - set(['OPTIONS', 'HEAD'])), rule.rule))
@app.route("/govuk")
def govuk():
return render_template('govuk_template.html')
@app.route("/helloworld")
def helloworld():
return render_template('hello-world.html')
if __name__ == '__main__': if __name__ == '__main__':
app.run(debug=True) manager.run()

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

+17
View File
@@ -1,6 +1,23 @@
from flask import render_template
from app.main import main from app.main import main
@main.route('/index') @main.route('/index')
def index(): def index():
return 'Hello from notifications-admin' return 'Hello from notifications-admin'
@main.route("/")
def idx():
return render_template('index.html')
@main.route("/govuk")
def govuk():
return render_template('govuk_template.html')
@main.route("/helloworld")
def helloworld():
return render_template('hello-world.html')

Before

Width:  |  Height:  |  Size: 152 B

After

Width:  |  Height:  |  Size: 152 B

Before

Width:  |  Height:  |  Size: 655 B

After

Width:  |  Height:  |  Size: 655 B

Before

Width:  |  Height:  |  Size: 780 B

After

Width:  |  Height:  |  Size: 780 B

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Before

Width:  |  Height:  |  Size: 761 B

After

Width:  |  Height:  |  Size: 761 B

Before

Width:  |  Height:  |  Size: 504 B

After

Width:  |  Height:  |  Size: 504 B

File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,3 +1,3 @@
#!/bin/bash #!/bin/bash
python application.py runserver python app.py runserver