mirror of
https://gitea.tendokyu.moe/AttackVector/AVNetwork.git
synced 2026-09-22 22:27:58 +03:00
38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
from flask import Flask
|
|
from flask_cors import CORS, cross_origin
|
|
|
|
from routes.home import commonAuth
|
|
|
|
def create_app(test_config=None):
|
|
"""Create and configure an instance of the Flask application."""
|
|
print( "== AttackVector NETWORK Services ==" )
|
|
# Create the Flask application instance
|
|
app = Flask(__name__, instance_relative_config=True)
|
|
CORS(app)
|
|
|
|
# Load configuration (optional)
|
|
if test_config is None:
|
|
# Load the default configuration from config.py (or another file)
|
|
app.config.from_pyfile("config.py", silent=True)
|
|
else:
|
|
# Apply test configuration, overriding defaults
|
|
app.config.update(test_config)
|
|
|
|
# apply the blueprints to the app
|
|
from routes.home import getResources, preLaunch, serverStatus
|
|
from routes.eacnet import needAuth
|
|
|
|
app.register_blueprint(getResources.bp)
|
|
app.register_blueprint(preLaunch.bp)
|
|
app.register_blueprint(serverStatus.bp)
|
|
app.register_blueprint(commonAuth.bp)
|
|
app.register_blueprint(needAuth.bp)
|
|
|
|
return app
|
|
|
|
|
|
# If the script is run directly (not imported), start development server
|
|
if __name__ == "__main__":
|
|
app = create_app()
|
|
app.run(host="0.0.0.0")
|