@@ -74,6 +74,8 @@ def component(
7474 </body>
7575 </html>
7676 """
77+ from django .conf import settings as django_settings
78+
7779 request : HttpRequest | None = context .get ("request" )
7880 perceived_host = (request .get_host () if request else "" ).strip ("/" )
7981 host = (
@@ -93,7 +95,7 @@ def component(
9395 _offline_html = ""
9496
9597 # Validate the host
96- if host and reactpy_config . REACTPY_DEBUG_MODE :
98+ if host and django_settings . DEBUG :
9799 try :
98100 validate_host (host )
99101 except InvalidHostError as e :
@@ -108,7 +110,7 @@ def component(
108110 return failure_context (dotted_path , ComponentDoesNotExistError (msg ))
109111
110112 # Validate the component args & kwargs
111- if is_local and reactpy_config . REACTPY_DEBUG_MODE :
113+ if is_local and django_settings . DEBUG :
112114 try :
113115 validate_component_args (user_component , * args , ** kwargs )
114116 except ComponentParamError as e :
@@ -234,17 +236,21 @@ def pyscript_setup(
234236 config: A JSON string or Python dictionary containing PyScript \
235237 configuration values.
236238 """
239+ from django .conf import settings as django_settings
240+
237241 return {
238242 "pyscript_config" : extend_pyscript_config (extra_py , extra_js , config ),
239243 "pyscript_layout_handler" : PYSCRIPT_LAYOUT_HANDLER ,
240- "reactpy_debug_mode " : reactpy_config . REACTPY_DEBUG_MODE ,
244+ "debug " : django_settings . DEBUG ,
241245 }
242246
243247
244248def failure_context (dotted_path : str , error : Exception ):
249+ from django .conf import settings as django_settings
250+
245251 return {
246252 "reactpy_failure" : True ,
247- "reactpy_debug_mode " : reactpy_config . REACTPY_DEBUG_MODE ,
253+ "debug " : django_settings . DEBUG ,
248254 "reactpy_dotted_path" : dotted_path ,
249255 "reactpy_error" : type (error ).__name__ ,
250256 }
0 commit comments