#!/usr/bin/env python
# coding: utf-8

from flask.ext.script import Server, Manager, Shell

from viralata.app import app
from extensions import db


manager = Manager(app)
manager.add_command('run', Server(host="0.0.0.0", port=5002))
manager.add_command('shell', Shell(make_context=lambda: {
    'app': app,
    'db': db,
}))


@manager.command
def initdb():
    from social.apps.flask_app.default import models as social_models
    import models

    social_models.PSABase.metadata.drop_all(db.engine)
    # models.Base.metadata.drop_all(db.engine)
    db.drop_all()

    db.create_all()
    # models.Base.metadata.create_all(db.engine)
    social_models.PSABase.metadata.create_all(db.engine)

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

#!/usr/bin/env python
# coding: utf-8

from flask.ext.script import Server, Manager, Shell

from viralata.app import app
from viralata.extensions import db


manager = Manager(app)
manager.add_command('run', Server(host="0.0.0.0", port=5002))
manager.add_command('shell', Shell(make_context=lambda: {
    'app': app,
    'db': db,
}))


@manager.command
def initdb():
    from social.apps.flask_app.default import models as social_models
    from viralata import models

    social_models.PSABase.metadata.drop_all(db.engine)
    # models.Base.metadata.drop_all(db.engine)
    db.drop_all()

    db.create_all()
    # models.Base.metadata.create_all(db.engine)
    social_models.PSABase.metadata.create_all(db.engine)

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

fix some errors