Giter Site home page Giter Site logo

Comments (9)

jacobh avatar jacobh commented on May 29, 2024

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.

jezdez avatar jezdez commented on May 29, 2024

@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.

jezdez avatar jezdez commented on May 29, 2024

regarding gizmag_secrets.settings.Secrets, does its module have an import for django.conf.settings?

from django-configurations.

jacobh avatar jacobh commented on May 29, 2024

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.

jacobh avatar jacobh commented on May 29, 2024

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.

jezdez avatar jezdez commented on May 29, 2024

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.

jezdez avatar jezdez commented on May 29, 2024

BTW, this is the culprit: https://bitbucket.org/andrewgodwin/south/src/6612130a3287a9e74bfa157d0a03af0a5df467d3/south/signals.py?at=default#cl-6

from django-configurations.

jacobh avatar jacobh commented on May 29, 2024

Thanks for the help :)

from django-configurations.

jezdez avatar jezdez commented on May 29, 2024

Gladly, @hzy!

from django-configurations.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.