add param support

This commit is contained in:
alphardex
2019-01-17 10:00:10 +08:00
parent 8a2f334c80
commit 91d5ecf57a
8 changed files with 40 additions and 77 deletions

View File

@@ -1,4 +1,5 @@
import os
from datetime import datetime
import click
from flask import Flask, render_template
from flask.cli import with_appcontext
@@ -19,6 +20,7 @@ def create_app(config_name=None):
register_blueprints(app)
register_extensions(app)
register_errors(app)
register_context_processors(app)
register_cli(app)
return app
@@ -48,6 +50,13 @@ def register_errors(app):
return render_template('errors/500.html'), 500
def register_context_processors(app):
@app.context_processor
def inject_date_now():
now = datetime.utcnow()
return {'now': now}
def register_cli(app):
@app.cli.command()
@with_appcontext