Beispiel #1
0
    def create_app(self):
        self.app = create_app("silverflask.settings.TestConfig", env="dev")
        db.init_app(self.app)

        with self.app.app_context():
            db.create_all()

        return self.app
Beispiel #2
0
#!/usr/bin/env python
import os

from flask.ext.script import Manager, Server
from silverflask import create_app, db
from silverflask.models import User, Page

# default to dev config because no one should use this in
# production anyway
env = os.environ.get('SILVERFLASK_ENV', 'dev')
app = create_app('silverflask.settings.%sConfig' % env.capitalize(), env=env)

manager = Manager(app)
manager.add_command("server", Server())


@manager.shell
def make_shell_context():
    """ Creates a python REPL with several default imports
        in the context of the app
    """

    return dict(app=app, db=db, User=User)


@manager.command
def createdb():
    """ Creates a database with all of the tables defined in
        your Alchemy models
    """
Beispiel #3
0
 def create_app(self):
     self.app = create_app("silverflask.settings.TestConfig", env="dev")
     return self.app
Beispiel #4
0
 def create_app(self):
     self.app = create_app("silverflask.settings.TestConfig", env="dev")
     return self.app
Beispiel #5
0
#!/usr/bin/env python
import os

from flask.ext.script import Manager, Server
from flask.ext.migrate import Migrate, MigrateCommand
from silverflask import create_app, db
from silverflask.models import User, Page

# default to dev config because no one should use this in
# production anyway
env = os.environ.get('SILVERFLASK_ENV', 'dev')
app = create_app('silverflask.settings.%sConfig' % env.capitalize(), env=env)

manager = Manager(app)
manager.add_command("server", Server())

migrate = Migrate(app, db)
manager.add_command('db', MigrateCommand)

@manager.shell
def make_shell_context():
    """ Creates a python REPL with several default imports
        in the context of the app
    """
    return dict(app=app, db=db, User=User)


@manager.command
def createdb():
    """
    Creates a database with the defined models