コード例 #1
0
def create_app(config_filename: str) -> Flask:
    app = Flask(__name__)

    # setup application environment
    app.config.from_object(config_filename)
    app.url_map.strict_slashes = False

    from app.database.sqlalchemy_extension import db

    db.init_app(app)

    migrate = Migrate(app, db)

    from app.api.jwt_extension import jwt

    jwt.init_app(app)

    from app.api.api_extension import api

    api.init_app(app)

    from app.api.mail_extension import mail

    mail.init_app(app)

    from app.schedulers.background_scheduler import init_schedulers

    init_schedulers()

    return app
コード例 #2
0
def create_app(config_env=None) -> Flask:
    app = Flask(__name__)
    if config_env:
        app.config.from_object(config_env)
    else:
        app.config[
            "SQLALCHEMY_DATABASE_URI"] = LocalConfig.SQLALCHEMY_DATABASE_URI
    app.url_map.strict_slashes = False

    load_dotenv(find_dotenv())
    """ Download service file from firebase and put it in project root directory """
    cred = credentials.Certificate("google-credentials.json")
    firebase_admin.initialize_app(cred)

    mail_settings = {
        "MAIL_SERVER": 'smtp.gmail.com',
        "MAIL_PORT": 465,
        "MAIL_USE_TLS": False,
        "MAIL_USE_SSL": True,
        "MAIL_USERNAME": environ.get('EMAIL_USER'),
        "MAIL_PASSWORD": environ.get('EMAIL_PASS')
    }

    app.config.update(mail_settings)

    api.init_app(app)
    db.init_app(app)

    from app.utils.mail_extension import mail
    mail.init_app(app)

    return app
コード例 #3
0
ファイル: run.py プロジェクト: 17sushmita/kanban-backend
def create_app():
    app = Flask(__name__)
    app.config['SQLALCHEMY_DATABASE_URI'] \
        = os.environ['DATABASE_URL']

    from app.database.sqlalchemy_extension import db

    db.init_app(app)

    from app.api.api_extension import api

    api.init_app(app)

    return app
コード例 #4
0
ファイル: run.py プロジェクト: lawcia/stem-diverse-tv
def create_app() -> Flask:
    
    app = Flask(__name__)
    
    app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///local_data.db"
    app.url_map.strict_slashes = False
    
    from app.apis import api
    api.init_app(app)
    
    from app.database.sqlalchemy_extension import db
    db.init_app(app)
    
    return app
コード例 #5
0
def create_app(config_env=None) -> Flask:
    app = Flask(__name__)
    if config_env:
        app.config.from_object(config_env)
    else:
        app.config[
            "SQLALCHEMY_DATABASE_URI"] = LocalConfig.SQLALCHEMY_DATABASE_URI
    app.url_map.strict_slashes = False

    load_dotenv(find_dotenv())
    """ Download service file from firebase and put it in project root directory """
    cred = credentials.Certificate("google-credentials.json")
    firebase_admin.initialize_app(cred)

    mail_settings = {
        "MAIL_SERVER": "smtp.gmail.com",
        "MAIL_PORT": 465,
        "MAIL_USE_TLS": False,
        "MAIL_USE_SSL": True,
        "MAIL_USERNAME": environ.get("EMAIL_USER"),
        "MAIL_PASSWORD": environ.get("EMAIL_PASS"),
    }

    cors.init_app(
        app,
        resources={
            r"*": {
                "origins": [
                    "http://localhost:3000",
                    "https://stem-diverse-tv.herokuapp.com/",
                ]
            }
        },
    )

    app.config.update(mail_settings)

    api.init_app(app)
    db.init_app(app)

    from app.utils.mail_extension import mail

    mail.init_app(app)

    return app
コード例 #6
0
ファイル: run.py プロジェクト: vatsalkul/study-partner
def create_app() -> Flask:

    app = Flask(__name__)

    app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///database.db"
    app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False

    app.url_map.strict_slashes = False

    # load_dotenv(find_dotenv())

    from app.database.sqlalchemy_extension import db
    db.init_app(app)

    from app.apis import api
    api.init_app(app)

    return app
コード例 #7
0
def create_app() -> Flask:

    app = Flask(__name__)

    app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///local_data.db"
    app.url_map.strict_slashes = False

    load_dotenv(find_dotenv())
    ''' Download service file from firebase and put it in project root directory '''
    cred = credentials.Certificate('google-credentials.json')
    firebase_admin.initialize_app(cred)

    from app.apis import api
    api.init_app(app)

    from app.database.sqlalchemy_extension import db
    db.init_app(app)

    return app