import tripadvisor import flask_script as script from flask_migrate import Migrate, MigrateCommand from prometheus_flask_exporter.multiprocess import UWsgiPrometheusMetrics from tripadvisor.models import User, Follow, TripAdvisor, Comment,\ Love, Child_cmt, Click, Comment_like app = tripadvisor.create_application() migrate = Migrate(app, tripadvisor.db) manager = script.Manager(app) manager.add_command('runserver', script.Server(host='0.0.0.0', port=8000)) manager.add_command('shell', script.Shell(make_context=lambda: {'current_app': app})) try: metrics = UWsgiPrometheusMetrics(app=app, default_labels={'project': 'hotel'}) metrics.start_http_server(9200) except ModuleNotFoundError: pass def make_shell_context(): return dict(app=app, db=tripadvisor.db, User=User, Follow=Follow, Food=Food, Survey=Survey, TripAdvisor=TripAdvisor)
"""Main program for Microsoft Graph Connect sample. To run the app, execute the command "python manage.py runserver" and then open a browser and go to http://localhost:5000/ """ import flask_script import connectsample MANAGER = flask_script.Manager(connectsample.app) MANAGER.add_command('runserver', flask_script.Server(host='localhost')) MANAGER.run()
"""Main program for Microsoft Graph Connect sample. To run the app, execute the command "python manage.py runserver" and then open a browser and go to http://localhost:5000/ """ import flask_script import connectsample MANAGER = flask_script.Manager(connectsample.app) MANAGER.add_command('runserver', flask_script.Server(host='0.0.0.0')) MANAGER.run()
import flask_script from flask_migrate import Migrate, MigrateCommand from sqlalchemy_utils import create_database, database_exists import minesweeper.app import minesweeper.config import minesweeper.extensions import minesweeper.models def make_app_context(): return {"app": minesweeper.app, "db": minesweeper.extensions.db} app = minesweeper.app.create_app() migrate = Migrate(app, minesweeper.extensions.db) manager = flask_script.Manager(app) manager.add_command("runserver", flask_script.Server("0.0.0.0", threaded=True)) manager.add_command("shell", flask_script.Shell(make_context=make_app_context)) manager.add_command("db", MigrateCommand) if __name__ == '__main__': manager.run()
import os import sys import flask_script from application import create_app sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) app = create_app() manager = flask_script.Manager(app) # turn on debugger by default and reloader manager.add_command("runserver", flask_script.Server(use_debugger=True, use_reloader=True, host=os.getenv('IP', '0.0.0.0'), port=int(os.getenv('PORT', 8080)))) if __name__ == "__main__": manager.run()
import flask_script from wg_forge_backend_test import create_application from wg_forge_backend_test.extensions import database from wg_forge_backend_test.cats import models from wg_forge_backend_test.commands import DatabaseFiller from wg_forge_backend_test.conf import Config manager = flask_script.Manager(create_application) manager.add_command("runserver", flask_script.Server()) manager.add_command("shell", flask_script.Shell()) manager.add_command("fill_database", DatabaseFiller()) @manager.shell def make_shell_context(): return dict(app=create_application(), config=Config, db=database, models=models) def main(): manager.run() if __name__ == '__main__': main()