Comments (9)
I added
from configurations import importer
importer.install()
to the top of my settings file and I now get the error
ImproperlyConfigured: The SECRET_KEY setting must not be empty.
I'm not sure if my issues are related to #27 . I'm inclined to think not as my settings file doesn't really do anything funky (as far as I know) https://gist.github.com/hzy/4c870d217d80bb398007
from django-configurations.
@hzy I wasn't able to reproduce the problem you describe. What version of django-configurations do you run?
You definitely don't need the installer to be imported in your settings and called.
What happens if you comment out the import and call of djcelery.setup_loader()
?
from django-configurations.
regarding gizmag_secrets.settings.Secrets
, does its module have an import for django.conf.settings
?
from django-configurations.
django-configurations==0.6 and Django==1.5.4.
I tried the different combinations of having djcelery.setup_loader()
commented out and it made no difference.
gizmag_secrets.settings entire contents is
class Secrets(object):
EMAIL_HOST_USER = ...
EMAIL_HOST_PASSWORD = ...
...
from django-configurations.
I think I found the issue. Just reading the traceback I noticed mention of gizmag/init.py. that file contains this little permission trick. When I commented it out gunicorn fired up instantly.
Maybe this is being called by gunicorn before configurations has a chance to kick in?
# register a signal do update permissions every migration.
# This is based on app django_extensions update_permissions command
from south.signals import post_migrate
def update_permissions_after_migration(app, **kwargs):
"""
Update app permission just after every migration.
This is based on app django_extensions update_permissions management command.
"""
from django.conf import settings
from django.db.models import get_app, get_models
from django.contrib.auth.management import create_permissions
create_permissions(get_app(app), get_models(), 2 if settings.DEBUG else 0)
post_migrate.connect(update_permissions_after_migration)
from django-configurations.
Aha! That must be it. When you try to import a module in a package like gizmag.wsgi
(as does gunicorn during startup) it'll also import the gismag/__init__.py
first, triggering the settings loading cycle. It's generally a good idea to not do that and instead put signal connection inside of models.py modules, which are guarenteed to be loaded by Django after the settings system has initialized.
I'm going to close this as a WONTFIX, but I'll keep this in mind in case further reports are coming in with similar situations.
from django-configurations.
BTW, this is the culprit: https://bitbucket.org/andrewgodwin/south/src/6612130a3287a9e74bfa157d0a03af0a5df467d3/south/signals.py?at=default#cl-6
from django-configurations.
Thanks for the help :)
from django-configurations.
Gladly, @hzy!
from django-configurations.
Related Issues (20)
- Improve code blocks in documentation
- Release minor version 2.4.1 HOT 3
- 2.4.1: pytest is failing HOT 2
- Replace deprecated imp module with importlib HOT 4
- How can this be used with `django.setup()` HOT 2
- Make magical importing optional
- <frozen importlib._bootstrap>:1049: ImportWarning: ConfigurationImporter.find_spec() not found; falling back to find_module() HOT 4
- "STATICFILES_STORAGE/STORAGES are mutually exclusive" on Django>=4.2
- WSGI application loaded twice unexpectedly
- Release 2.4.2 is not on PyPI HOT 9
- Update Python and Django supported versions
- Add support for Python 3.12 HOT 1
- DeprecationWarning for USE_DEPRECATED_PYTZ, CSRF_COOKIE_MASKED, USE_L10N
- Broken link in `Configuration.load_dotenv` docstring HOT 1
- Add Django 5.0 classifier
- Publish version 2.5.1 on PyPi HOT 2
- Values not working in DATABASES dictionary and values.Value returning Value instance type instead of a str HOT 1
- DOTENV - Using environ_name strange behevior HOT 1
- 2.5.1: documentation build fails
- Move `ConfigurationLoader` to use the PEP-451 style loader
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-configurations.