I'm using Django 1.8.
I'm trying to wire up the django-registration user_registration signal.
To wire up a signal, this post is pretty explicit: use AppConfig.ready(). I think I have it wired up correctly, but clearly I don't, because it's not working. So, to see what happened, I deliberately misspelled the name of the config class in my registrationapp/__init__.py:
default_app_config = 'registrationapp.apps.RegistrationAppConfgOOPS'
I don't see any error message, or any message.
How do I tell if registrationapp/__init__.py is even being loaded, and if the right app config is being created and loaded?
By the way, I set up console logging exactly as described here, but it doesn't log much to the console, not sure why. (It does log the GET requests, but they look to be different logging.)
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'console': {
'class': 'logging.StreamHandler',
},
},
'loggers': {
'django': {
'handlers': ['console'],
'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),
},
},
}
How do I tell if registrationapp/__init__.py
is even being loaded?
A very simple way would be putting a top-level print()
in it. If it's loaded, you will see the output.
...and if the right app config is being created and loaded?
Same thing, put a print()
in your app config file.
I just tried using a bogus name for default_app_config
in my project and Django raised an AttributeError
, so I think that indeed your app is not being found.
Regarding logging, the documentation says this:
By default, this config only sends messages of level INFO or higher to the console. Django does not log many such messages. Set the environment variable DJANGO_LOG_LEVEL=DEBUG to see all of Django’s debug logging which is very verbose as it includes all database queries.
So try using os.getenv('DJANGO_LOG_LEVEL', 'DEBUG')
instead.