#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ # @Version : Python 3.11.4 # @Software : Sublime Text 4 # @Author : StudentCWZ # @Email : StudentCWZ@outlook.com # @Date : 2023/10/28 13:49 # @File : app.py # @Description : """ from application import create_app def runserver(): """ This function creates a new instance of the Flask application and runs it. It retrieves the host and port from the application configuration and uses these values when running the app. Please note that the Flask development server is not meant to be used in a production environment. It's intended to be used in development, where you can easily restart the server whenever you make changes to your code. """ # Create a new instance of the Flask application. # The create_app() function should be defined elsewhere in your project, # and should return an instance of the Flask class. app = create_app() # Retrieve the server configuration from the Flask application config. # The 'Server' key is assumed to be a dictionary containing the keys 'IP' and 'Port'. cfg = app.config['Server'] # Retrieve the port from the config. port = cfg.get('Port', 5000) # Run the Flask development server. app.run(host='0.0.0.0', port=port, use_reloader=False) if __name__ == '__main__': """ This condition is true if the script is run directly. If the script is imported from another script, the condition is false. This allows you to use this script's functions without running the server if you import this script from another script. """ # Only run the development server if the script is executed directly. runserver()