INNER CODE UNIT · Python

create_app

giuseppe99barchetta/SuggestArr · api_service/app.py:74

def create_app():
    """
    Create and configure the Flask application.
    """

    if AppUtils.is_last_worker():
        AppUtils.print_welcome_message() # Print only for last worker

    static_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "static"))
    if not os.path.isdir(static_dir):
        static_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "client", "dist"))
    application = Flask(__name__, static_folder=static_dir)

    # ------------------------------------------------------------------
    # Reverse-proxy trust
    # Trust one hop of X-Forwarded-For / X-Forwarded-Proto so that:
    #   - Rate limiting uses the real client IP (not the proxy IP).
    #   - Secure cookie detection works correctly behind HTTPS terminators.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…