Django 3.2 exception: django.core.exceptions.ImproperlyConfigured

3

I'm upgrading to django 3.2 but as per it's release notes, it says:

The SECRET_KEY setting is now checked for a valid value upon first access, rather than when settings are first loaded. This enables running management commands that do not rely on the SECRET_KEY without needing to provide a value. As a consequence of this, calling configure() without providing a valid SECRET_KEY, and then going on to access settings.SECRET_KEY will now raise an ImproperlyConfigured exception.

Error: django.core.exceptions.ImproperlyConfigured: Cannot import 'users'. Check that 'apps.users.apps.UsersConfig.name' is correct.

Users apps.py:

from django.apps import AppConfig

class UsersConfig(AppConfig):
    name = 'users'

I think that error is because of such as it was working with django==3.1.7. Can someone help me to solve this? How can i check if my secret key is valid or not and also generate new if needed?

Share
Improve this question
4
  • Is the SECRET_KEY configured in your settings.py file? Did you provide default value for it? For example it should be similar to this: SECRET_KEY = env('DJANGO_SECRET_KEY', default='xxxxxx') Also, provide the full error message – Zhivko Zaikov Apr 12 at 10:21
  • Added full error. Settings has this line for SECRET_KEY. SECRET_KEY = os.environ.get('SECRET_KEY') – vivekpadia70 Apr 12 at 10:52
  • 2
    Check how "users" is defined and provide the relevant code – Zhivko Zaikov Apr 12 at 11:01
  • Upvoting the question. I had exact same issue. Yes this started from 3.2. – lapin Apr 24 at 12:02

Comments

Popular posts from this blog

Meaning of `{}` for return expression

Get current scroll position of ScrollView in React Native

Chart JS +ng2-charts not working on Angular+2