Skip to content

Commit 0f5cc8e

Browse files
committed
fix application root fix #612
1 parent 45e9612 commit 0f5cc8e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

atlas/configuration/config_schema.py

+10
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
ValidationError,
66
validates_schema,
77
EXCLUDE,
8+
post_load
89
)
910
from marshmallow.validate import Regexp
1011

@@ -237,3 +238,12 @@ def validate_url_taxhub(self, data, **kwargs):
237238
raise ValidationError(
238239
{"Le champ TAXHUB_URL doit être rempli si REDIMENSIONNEMENT_IMAGE = True"}
239240
)
241+
242+
@post_load
243+
def post_load(self, data, **kwargs):
244+
# Set APPLICATION_ROOT Flask parameter (use for url_for etc...) https://flask.palletsprojects.com/en/stable/config/#APPLICATION_ROOT
245+
# the parameter is infered from URL_APPLICATION which is widely use in all the application
246+
url_application = data["URL_APPLICATION"]
247+
data["APPLICATION_ROOT"] = url_application if url_application != "/" else "/"
248+
return data
249+

0 commit comments

Comments
 (0)