from models import db, User from routes import create_app #create database and tables db.create_all(app=create_app()) #user = User("kim", "*****@*****.**", "password") #db.session.add(user) #db.session.commit()
import os from flask_script import Manager from flask_migrate import Migrate, MigrateCommand # from app import app, db from user_app.models import db from routes import create_app app = create_app() migrate = Migrate(app, db) manager = Manager(app) manager.add_command('db', MigrateCommand) if __name__ == '__main__': manager.run() # python manage.py db init # python manage.py db migrate # python manage.py db upgrade
import psycopg2 from routes import create_app db_con = psycopg2.connect( host='localhost', database='postgres', user='******', password='******') app = create_app(db_con) if __name__ == '__main__': app.run(debug=True)
# Internal packages from routes import create_app if __name__ == "__main__": application = create_app() application.run()
#!/env/python # coding=utf-8 import routes import os ''' pro:生产环境配置 test:测试环境配置 ''' os.environ["env"] = "pro" app = routes.create_app() if __name__ == "__main__": app.debug = True app.run(host='0.0.0.0', port=5000)
from configurations import DevelopmentConfig # Internal packages from routes import create_app if __name__ == "__main__": app = create_app(config_class=DevelopmentConfig) app.run()