diff --git a/back/Dockerfile b/back/Dockerfile index 8c384c12c..14b43417b 100755 --- a/back/Dockerfile +++ b/back/Dockerfile @@ -13,15 +13,11 @@ RUN pip install -r requirements.txt && rm requirements.txt # cf. https://stackoverflow.com/a/60820156/3865876 FROM base AS production # Launch WSGI server, configured by gunicorn.conf.py -ENV FLASK_ENV production CMD gunicorn FROM base AS development # Path of module containing Flask app, relative to WORKDIR -ENV FLASK_APP boxtribute_server/main -ENV FLASK_ENV development -CMD flask run -h 0.0.0 -p 5000 +CMD flask --debug --app boxtribute_server.main run -h 0.0.0 -p 5000 # Select final stage depending on flask_env argument FROM ${flask_env} AS final -RUN echo Using $FLASK_ENV diff --git a/back/boxtribute_server/routes.py b/back/boxtribute_server/routes.py index 017970497..2ee6ba8c8 100644 --- a/back/boxtribute_server/routes.py +++ b/back/boxtribute_server/routes.py @@ -3,7 +3,7 @@ from ariadne import graphql_sync from ariadne.constants import PLAYGROUND_HTML -from flask import Blueprint, jsonify, request +from flask import Blueprint, current_app, jsonify, request from flask_cors import cross_origin from .auth import request_jwt, requires_auth @@ -47,7 +47,7 @@ def query_api_server(): query_api_schema, data=request.get_json(), context_value=request, - introspection=os.getenv("FLASK_ENV") == "development", + introspection=current_app.debug, error_formatter=format_database_errors, ) @@ -91,7 +91,7 @@ def graphql_server(): data=request.get_json(), context_value=request, debug=debug_graphql, - introspection=os.getenv("FLASK_ENV") == "development", + introspection=current_app.debug, error_formatter=format_database_errors, )