Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django 3.2 exception: django.core.exceptions.ImproperlyConfigured

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?

like image 556
vivekpadia70 Avatar asked Apr 12 '21 10:04

vivekpadia70


1 Answers

I don't think your error is directly related to that SECRET_KEY change in your question.

AppConfig.name should be the full Python path to the application. Since you appear to have users inside an apps module, you should use 'apps.users' instead of 'users'

class UsersConfig(AppConfig):
    name = 'apps.users'
like image 162
Alasdair Avatar answered Sep 22 '22 17:09

Alasdair