from gather import create_app from gather.utils.exts import db from flask_script import Manager from flask_migrate import Migrate, MigrateCommand # 创建flask应用对象 app = create_app("develop") app.template_folder = 'static/html' from flask import request, render_template, jsonify @app.route('/test_post', methods=['POST', 'GET']) def test_post(): if request.method == 'GET': return render_template('test_post.html') elif request.method == 'POST': return jsonify('ok') manager = Manager(app) migrate = Migrate(app, db) manager.add_command("db", MigrateCommand) if __name__ == '__main__': manager.run()
from flask.ext.script import Manager from flask.ext.migrate import Migrate, MigrateCommand from flask.ext.assets import ManageAssets from livereload import Server from gather import create_app from gather.extensions import db app = create_app() migrate = Migrate(app, db) manager = Manager(app) manager.add_command("db", MigrateCommand) manager.add_command("assets", ManageAssets()) @manager.command def create_all(): db.create_all() @manager.command def clear_cache(): from gather.extensions import cache with app.app_context(): cache.clear() @manager.command def clean_junk_users():
from gather import create_app from gather.settings import load_production_settings application = create_app() load_production_settings(application) if application.config.get("SENTRY_DSN", None): from raven.contrib.flask import Sentry Sentry(application)
from flask.ext.script import Manager from flask.ext.migrate import Migrate, MigrateCommand from flask.ext.assets import ManageAssets from livereload import Server from gather import create_app from gather.extensions import db app = create_app() migrate = Migrate(app, db) manager = Manager(app) manager.add_command("db", MigrateCommand) manager.add_command("assets", ManageAssets()) @manager.command def create_all(): db.create_all() @manager.command def clear_cache(): from gather.extensions import cache with app.app_context(): cache.clear() @manager.command def clean_junk_users(): from gather.account.models import Account