Started documentation for blueprints
This commit is contained in:
parent
b4ffa4d9ac
commit
bfd67764fb
4 changed files with 94 additions and 30 deletions
|
|
@ -1,19 +1,10 @@
|
|||
from flask import Flask, Module
|
||||
from flask import Flask, Module, render_template
|
||||
|
||||
|
||||
mod = Module(__name__)
|
||||
mod2 = Module(__name__, 'testmod2')
|
||||
mod3 = Module(__name__, name='somemod', subdomain='meh')
|
||||
|
||||
app = Flask(__name__)
|
||||
app.register_module(mod)
|
||||
app.register_module(mod2)
|
||||
|
||||
|
||||
def handle_404(error):
|
||||
return 'Testing', 404
|
||||
app.error_handlers[404] = handle_404
|
||||
|
||||
|
||||
@app.after_request
|
||||
def after_request(response):
|
||||
|
|
@ -27,10 +18,20 @@ def index():
|
|||
|
||||
|
||||
@mod2.route('/')
|
||||
def index():
|
||||
def mod2_index():
|
||||
return render_template('testmod2/index.html')
|
||||
|
||||
|
||||
@mod2.route('/')
|
||||
def index():
|
||||
@mod3.route('/')
|
||||
def mod3_index():
|
||||
return render_template('something-else/index.html')
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
app.register_module(mod)
|
||||
app.register_module(mod2)
|
||||
|
||||
|
||||
def handle_404(error):
|
||||
return 'Testing', 404
|
||||
app.error_handlers[404] = handle_404
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue