test.py
This file
Path
scripts/testproj/test.py
37 lines · 674 bytes · Python
Last changed by
Started documentation for blueprintsArmin Ronacherbefore adoptionbfd6776
History of this fileTake it
Started documentation for blueprintsArmin Ronacherbefore adoptionbfd6776
line 1why, one step back1from flask import Flask, Module, render_templateAdded test project I use for testingArmin Ronacherbefore adoption670d2bc
lines 2–5why, one step back234mod = Module(__name__)5mod2 = Module(__name__, 'testmod2')Allow name to be specified as the first parameter but with an explict name.Armin Ronacherbefore adoptionb4ffa4d
line 6why, one step back6mod3 = Module(__name__, name='somemod', subdomain='meh')Added test project I use for testingArmin Ronacherbefore adoption670d2bc
lines 7–20why, one step back789@app.after_request10def after_request(response):11 g.db.close()12 return response131415@mod.route('/')16def index():17 return render_template('test/index.html')181920@mod2.route('/')Started documentation for blueprintsArmin Ronacherbefore adoptionbfd6776
line 21why, one step back21def mod2_index():Added test project I use for testingArmin Ronacherbefore adoption670d2bc
lines 22–24why, one step back22 return render_template('testmod2/index.html')2324Started documentation for blueprintsArmin Ronacherbefore adoptionbfd6776
lines 25–26why, one step back25@mod3.route('/')26def mod3_index():Added test project I use for testingArmin Ronacherbefore adoption670d2bc
line 27why, one step back27 return render_template('something-else/index.html')Started documentation for blueprintsArmin Ronacherbefore adoptionbfd6776
lines 28–37why, one step back282930app = Flask(__name__)31app.register_module(mod)32app.register_module(mod2)333435def handle_404(error):36 return 'Testing', 40437app.error_handlers[404] = handle_404