示例#1
0
from FlaskBlog import create_app

app = create_app()

if __name__ == '__main__':
    app.run(debug=True)  # now can be run via cmd as: python FlaskBlog.py
示例#2
0
#
# if __name__ == '__main__':
#     manager.run()

import os

from flask.ext.script import Manager, Server
from flask.ext.migrate import Migrate, MigrateCommand

from FlaskBlog import create_app
from FlaskBlog import models

# Get the ENV from os_environ
env = os.environ.get('BLOG_ENV', 'dev')
# Create thr app instance via Factory Method
app = create_app('FlaskBlog.config.%sConfig' % env.capitalize())
# Init manager object via app object
manager = Manager(app)

# Init migrate object via app and db object
migrate = Migrate(app, models.db)

# Create some new commands
manager.add_command("server", Server(host='127.0.0.1', port=8089))
manager.add_command("db", MigrateCommand)


@manager.shell
def make_shell_context():
    """Create a python CLI.