def create_template_app(**kwargs): """Create a template Flask app""" app = create_app(**kwargs) from .views import public # this must be placed here, after the app is # created app.register_blueprints(public) return app
def create_core_app(**kwargs): """Create a template Flask app""" app = create_app(__name__, **kwargs) app.register_blueprints(public, sphere) return app
# the main Flask application from client import create_app app = create_app() if __name__ == "__main__": app.run(**app.config['INIT'])
def app(): """New app for test mode""" app = create_app(config='TestConfig') return app
# Copyright © 2018 Stanislav Hnatiuk. All rights reserved. """Module of <...>.""" from client import create_app app = create_app() app.run()
def create_outline_app(**kwargs): """Create a template Flask app""" app = create_app(__name__, **kwargs) app.register_blueprints(public, admin) return app
from flask import Flask, session, redirect, url_for, render_template, request, jsonify, Response, flash, Blueprint, session import json import os import boto3 from datetime import datetime import json from client import create_app import stripe import requests #MUST CHANGE WHEN CLIENT APP DEPLOYED # CLIENT_CHARGE_URL="http://eunicekokor.localhost.run/charge" application = create_app() application.config.from_object('config') boto_session = boto3.session.Session( aws_access_key_id=application.config['AWS_ACCESS_KEY_ID'], aws_secret_access_key=application.config['AWS_SECRET_ACCESS_KEY']) db = boto_session.resource('dynamodb', region_name='us-west-2') stripe_keys = { 'secret_key': application.config['STRIPE_SECRET_KEY'], } stripe.api_key = stripe_keys['secret_key'] # @application.route('/charge', methods=['GET']) # def thanks(): @application.route('/', methods=['GET']) def index(): return "HelloWorld"
dotenv_path = os.path.join(os.path.dirname(__file__), ".env") if os.path.exists(dotenv_path): load_dotenv(dotenv_path) COV = None if os.environ.get("FLASK_COVERAGE"): import coverage COV = coverage.coverage(branch=True, include="client/*") COV.start() import sys import click from flask_migrate import Migrate, upgrade from client import create_app, db app = create_app(os.getenv("FLASK_ENV") or "default") migrate = Migrate() with app.app_context(): migrate.init_app(app, db, render_as_batch=True) @app.cli.command() @click.option("--coverage/--no-coverage", default=False, help="Run tests under code coverage.") def test(coverage): """Run the unit tests.""" if coverage and not os.environ.get("FLASK_COVERAGE"): import subprocess os.environ["FLASK_COVERAGE"] = "1" sys.exit(subprocess.call(sys.argv))
#!/bin/env python from flask_socketio import emit from client import create_app, socketio app = create_app(debug=True) socketio.run(app, host='0.0.0.0', port=9081) if __name__ == "__main__": pass