You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have Some classes inherent from configurations.Configuration In settings.py such as below
class Common(Configuration):
REDIS_HOST = 'xxx'
class Dev(Common):
REDIS_HOST = 'dev_xxx'
class Prod(Common):
REDIS_HOST = 'prod_xxx'
How could I get the correct REDIS_HOST in other python modules in the same project.
AFAIK, I could test the environment which my project running on, so use the correct Class#properties. But, I want to know is there any better solutions for these things.
Your example reads like the server specific usage pattern in the docs. You need to set the environment variable DJANGO_CONFIGURATION to the configuration class name you want to use.
In your code you simply access the Django settings as usual.
Anything else unclear? Should we add something more to the documentation?
I have Some classes inherent from
configurations.Configuration
In settings.py such as belowHow could I get the correct REDIS_HOST in other python modules in the same project.
AFAIK, I could test the environment which my project running on, so use the correct Class#properties. But, I want to know is there any better solutions for these things.
I read the docs, but didn't find any solutions.
The text was updated successfully, but these errors were encountered: