updated django from 1.4 to 1.5.1; now DeprecationWarning on setup_environ

django, django-1.5, python, updates

Solution

I end up adding:

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings") 

not only to my manage.py file, but also in the app files where I was calling 'setup_environ'. So, I replace this code:

from django.core.management import setup_environ
from mysite import settings
setup_environ(settings)

with:

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings") 

No DeprecationWarning and seems like its working!

Problem

updated django from 1.4 to 1.5.1 now its throwing this: DeprecationWarning: The 'setup_environ' function is deprecated, you likely need to update your 'manage.py'; please see the Django 1.4 release notes (https://docs.djangoproject.com/en/dev/releases/1.4/). First, I was already on v1.4 so why its showing this now? well.. manage.py already have this: ``` os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings") ``` but few apps using this: ``` from django.core.management import setup_environ from mysite import settings setup_environ(settings) ``` if I comment the above code it throws an error: django.core.exceptions.ImproperlyConfigured: Requested setting AUTH_USER_MODEL, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings. so, I called 'settings.configure' and replaced the above code with: ``` from django.conf import settings from mysite import settings as mysettings settings.configure(mysettings, DEBUG=True) ``` but it's still throwing as error! AttributeError: 'module' object has no attribute 'LOGGING_CONFIG' basically 'setup_environ' is working but with the DeprecationWarning, how can I get ride of it? Obviously, I red the release notes 1.4 but can't figure this out..

Original source