# wsgi.py

"""
Flask Application Runner Script

This script serves as the entry point for running a Flask web application. It utilizes the decouple library for configuration
and imports the create_app function from the app module to create the Flask application instance.

Configuration options for running the application:
- HOST: The host on which the application should listen. Defaults to '0.0.0.0'.
- PORT: The port on which the application should run. Defaults to 5000.
- DEBUG: Whether to run the application in debug mode. Defaults to True.

Usage:
    python wsgi.py

"""

# Import the 'config' function from the 'decouple' library
from decouple import config 

# Import the 'create_app' function from the 'app' module
from app import create_app

# Create a Flask application instance using the create_app function from the app module
app = create_app()

# Check if the script is the main entry point
if __name__ == '__main__':
    # Run the Flask application with specified configuration options

    # Configuration options:
    #   - HOST: The host on which the application should listen. Defaults to '0.0.0.0'.
    #   - PORT: The port on which the application should run. Defaults to 5000.
    #   - DEBUG: Whether to run the application in debug mode. Defaults to True.

    app.run(
        host=config("HOST", default='0.0.0.0', cast=str),
        port=config("PORT", default=5000, cast=int),
        debug=config("DEBUG", default=True, cast=bool)
    )
