SpartaHack/SpartaHack-API

View on GitHub
wsgi.py

Summary

Maintainability
A
0 mins
Test Coverage
import os
from app import create_app
import logging
from dotenv import load_dotenv
from pathlib import Path  # python3 only
env_path = Path('.') / '.env'
load_dotenv(verbose=True, dotenv_path=env_path)
if os.getenv("FLASK_ENV") == "DEV":
    config = "DevelopmentConfig"
else:
    config = "ProdConfig"
app = create_app(config)

if __name__ != '__main__':
    gunicorn_logger = logging.getLogger('gunicorn.error')
    app.logger.handlers = (gunicorn_logger.handlers)
    app.logger.setLevel(gunicorn_logger.level)

if __name__ == '__main__':
    app.run(debug=app.config.get("DEBUG", False))