-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
34 lines (28 loc) · 1.17 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from flask import Flask
from flask_caching import Cache
from services import VideoServer
"""
Function to create and configure a Flask application instance.
Args:
config_path (str): The path to the configuration file for the app and video server. Defaults to 'config.ini'.
Returns:
app: A configured Flask application instance.
video_server: An instance of the VideoServer, initialized with the app and cache.
"""
def create_app(config_path='config.ini'):
# Create a Flask application instance
app = Flask(__name__)
# Initialize cache for the application (set to 'null' cache type for now)
cache = Cache(app, config={'CACHE_TYPE': 'null'})
# Initialize VideoServer with the Flask app, cache, and config path
video_server = VideoServer(app, cache, config_path)
return app, video_server
"""
Main entry point of the application.
Creates the Flask app and VideoServer, and starts the video server when run as the main script.
"""
if __name__ == '__main__':
# Create the app and video server instances
app, video_server = create_app()
# Run the video server (likely starts the Flask app with additional functionality)
video_server.run()