def create_app(sqlite_path='sqlite:///intent.db'):
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = sqlite_path
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['BASIC_AUTH_USERNAME'] = 'john'
app.config['BASIC_AUTH_PASSWORD'] = 'matrix'
babel = Babel(app)
admin = Admin(app, name='PrayerBot', template_mode='bootstrap3')
db.init_app(app)
register_admin(admin, app)
app.app_context().push()
app.add_url_rule('/webhook', view_func=WebhookAPI.as_view('webhook'))
app.add_url_rule('/privacy', view_func=PrivacyPolicy.as_view('privacy'))
if os.environ.get('ACCESS_TOKEN'):
utils.send_greeting_text_config()
db.create_all()
db.session.commit()
db.session.autoflush = True
db.session.autocommit = True
return app
评论列表
文章目录