예제 #1
0
def client():
    from mysite import create_app
    app = create_app(config_file=CONFIG_FILE)
    with app.app_context():
        from mysite import db
        db.create_all()
    app.config['TESTING'] = True
    with app.test_client() as c:
        yield c
예제 #2
0
from mysite import db, create_app
db.create_all(app=create_app())
예제 #3
0
import os
from flask_script import Manager, Server
from flask_script.commands import ShowUrls
from flask_migrate import Migrate, MigrateCommand
from mysite.extensions import db
from mysite import create_app

env = os.environ.get('APP_ENV', 'dev')
app = create_app('mysite.config.%sConfig' % env.capitalize())

migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command("server", Server())
manager.add_command("show-url", ShowUrls())
manager.add_command("db", MigrateCommand)


@manager.shell
def make_shell_context():
    return dict(
        app=app,
        db=db
    )


@manager.command
def setup_db():
    db.create_all()

if __name__ == "__main__":
    manager.run()
예제 #4
0
파일: manage.py 프로젝트: lossme/cookbook
import os

from flask_script import Manager

from mysite import create_app, celery

here = os.path.abspath(os.path.dirname(__file__))
config_file = os.path.join(here, 'config/config.py')

app = create_app(config_file)
manager = Manager(app)

if __name__ == '__main__':
    manager.run()
예제 #5
0
from mysite import create_app

app = create_app("mysite.config.ProdConfig")
예제 #6
0
파일: run.py 프로젝트: ssloat/finances
from mysite import create_app
app = create_app()
app.run(debug=True)
예제 #7
0
 def create_app(self):
     return create_app(self)
예제 #8
0
from gevent.wsgi import WSGIServer
from mysite import create_app

app = create_app('mysite.config.ProdConfig')

server = WSGIServer(('', 80), app)
server.serve_forever()
예제 #9
0
파일: manage.py 프로젝트: geekone/pyweb
# -*- coding:utf-8 -*-
from flask import Flask, current_app
from flaskext.script import Server, Shell, Manager, Command, prompt_bool

from mysite import create_app
from mysite.extensions import db
from mysite.models.model import User

manager = Manager(create_app('config.cfg'))

manager.add_command("runserver", Server('0.0.0.0',port=8080))

def _make_context():
    return dict(db=db)
manager.add_command("shell", Shell(make_context=_make_context))

@manager.command
def createall():
    "Creates database tables"
    db.create_all()

@manager.command
def dropall():
    "Drops all database tables"
    if prompt_bool("Are you sure ? You will lose all your data !"):
        db.drop_all()


if __name__ == "__main__":
    manager.run()