mirror of
https://github.com/kevinveenbirkenbach/homepage.veen.world.git
synced 2026-09-11 21:46:47 +00:00
fix(app): print the startup line only when app.py runs as a script
The "Starting app on host:port" line sat at module level, so every import printed it, including the test suites and any WSGI server that loads the module; CodeQL reported it as a print during import. It now lives in the __main__ block, which the Docker CMD and the e2e runner reach through python app.py; the e2e Flask log still shows the line. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -28,7 +28,6 @@ logging.basicConfig(level=logging.DEBUG)
|
|||||||
FLASK_ENV = os.getenv("FLASK_ENV", "production")
|
FLASK_ENV = os.getenv("FLASK_ENV", "production")
|
||||||
FLASK_HOST = os.getenv("FLASK_HOST", "127.0.0.1")
|
FLASK_HOST = os.getenv("FLASK_HOST", "127.0.0.1")
|
||||||
FLASK_PORT = int(os.getenv("FLASK_PORT", os.getenv("PORT", 5000)))
|
FLASK_PORT = int(os.getenv("FLASK_PORT", os.getenv("PORT", 5000)))
|
||||||
print(f"Starting app on {FLASK_HOST}:{FLASK_PORT}, FLASK_ENV={FLASK_ENV}")
|
|
||||||
|
|
||||||
# Initialize the CacheManager
|
# Initialize the CacheManager
|
||||||
cache_manager = CacheManager()
|
cache_manager = CacheManager()
|
||||||
@@ -190,6 +189,7 @@ def localized_index(lang):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
print(f"Starting app on {FLASK_HOST}:{FLASK_PORT}, FLASK_ENV={FLASK_ENV}")
|
||||||
app.run(
|
app.run(
|
||||||
debug=(FLASK_ENV == "development"),
|
debug=(FLASK_ENV == "development"),
|
||||||
host=FLASK_HOST,
|
host=FLASK_HOST,
|
||||||
|
|||||||
Reference in New Issue
Block a user