0

I want to set an if condition in settings.py in my django app, to check the url and apply correct GOOGLE_RECAPTCHA_SECRET_KEY for the site. because of difference in local host and web server domin. I used requests._current_scheme_host but get an error:

File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/apps/registry.py", line 136, in check_apps_ready raise AppRegistryNotReady("Apps aren't loaded yet.") django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

1 Answers1

0

This might help someone!

When working with multiple environments, create separate file for each environment and enable the required environment from the settings.py file. Ensure to add the attributes in all the env files.

For eg. My app folder looks like this.

enter image description here

And now in settings.py, will enable the required env.

enter image description here

In case, if you have common attributes to be used for all envs, create a common.py file under environments folder and keep it enabled in all env servers.

Ananthi
  • 413
  • 7
  • 13