def create_app(): # Flask Setup app = Flask(__name__, template_folder=os.path.join(os.path.dirname(__file__), '..', 'views'), static_folder=os.path.join(os.path.dirname(__file__), '..', 'static'), static_url_path=base_url.rstrip('/') + '/static') app.wsgi_app = ReverseProxied(app.wsgi_app) app.route = prefix_route(app.route, base_url.rstrip('/')) app.config["SECRET_KEY"] = settings.general.flask_secret_key app.config['JSONIFY_PRETTYPRINT_REGULAR'] = True app.config['JSON_AS_ASCII'] = False if args.dev: app.config["DEBUG"] = True # Flask-Debuger app.config["DEBUG_TB_ENABLED"] = True app.config["DEBUG_TB_PROFILER_ENABLED"] = True app.config["DEBUG_TB_TEMPLATE_EDITOR_ENABLED"] = True app.config["DEBUG_TB_INTERCEPT_REDIRECTS"] = False else: app.config["DEBUG"] = False # Flask-Debuger app.config["DEBUG_TB_ENABLED"] = False toolbar = DebugToolbarExtension(app) socketio.init_app(app, path=base_url.rstrip('/')+'/socket.io', cors_allowed_origins='*', async_mode='threading') return app
def create_app(): # Flask Setup app = Flask(__name__, template_folder=os.path.join(os.path.dirname(__file__), '..', 'frontend', 'build'), static_folder=os.path.join(os.path.dirname(__file__), '..', 'frontend', 'build', 'static'), static_url_path=base_url.rstrip('/') + '/static') app.wsgi_app = ReverseProxied(app.wsgi_app) app.route = prefix_route(app.route, base_url.rstrip('/')) app.config["SECRET_KEY"] = settings.general.flask_secret_key app.config['JSONIFY_PRETTYPRINT_REGULAR'] = True app.config['JSON_AS_ASCII'] = False if args.dev: app.config["DEBUG"] = True else: app.config["DEBUG"] = False socketio.init_app(app, path=base_url.rstrip('/') + '/api/socket.io', cors_allowed_origins='*', async_mode='threading', allow_upgrades=False, transports='polling') return app
import warnings import logging import os import io from waitress.server import create_server from get_args import args from config import settings, base_url from database import database from app import create_app app = create_app() from api import api_bp_list for item in api_bp_list: app.register_blueprint(item, url_prefix=base_url.rstrip('/') + '/api') class Server: def __init__(self): # Mute DeprecationWarning warnings.simplefilter("ignore", DeprecationWarning) # Mute Insecure HTTPS requests made to Sonarr and Radarr warnings.filterwarnings('ignore', message='Unverified HTTPS request') # Mute Python3 BrokenPipeError warnings.simplefilter("ignore", BrokenPipeError) self.server = create_server( app, host=str(settings.general.ip), port=int(args.port) if args.port else int(settings.general.port),