Getting ‘Settings’ object has no attribute ‘API_KEY’ as an error when trying to use API_KEY = os.environ[‘API_KEY’] in my settings file and then reference it like this: google_maps_key = settings.GOOGLE_MAPS_API_KEY in my code. Works fine in my heroku app, does anyone know how to fix? I’m using a custom settings file and I’ve ensured DJANGO_SETTINGS_MODULE env varible is set to the correct file.
I’m sure it’s loaded the settings file correctly as there was an unassigned variable error when building it located in the file that I’ve since changed but it just seems to not be able to get attributes on the settings object.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.