from run import app from api import setup_api from database.create_db import create_db_if_not_exists if __name__ == "__main__": create_db_if_not_exists() setup_api() app.run(debug=True, host="0.0.0.0", port=5000)
from flask import Flask import api import common import config import template_filters import views import os app = Flask(__name__) app.secret_key = config.FLASK_SECRET template_filters.setup_template_filters(app) views.setup_views(app) api.setup_api(app) if os.environ.get("ODDB_USER", False) and os.environ.get("ODDB_PASSWORD", False): user = os.environ["ODDB_USER"] password = os.environ["ODDB_PASSWORD"] try: common.db.generate_login(user, password) print("Generated user %s" % user) except: pass if __name__ == '__main__': app.run("0.0.0.0", port=80, threaded=True)
from app import app, db from flask_script import Manager from flask_migrate import Migrate, MigrateCommand from api import setup_api manager = Manager(app) setup_api(app) migrate = Migrate(app, db) manager.add_command('db', MigrateCommand) @manager.command def create_database(): db.create_all() if __name__ == "__main__": manager.run()