I am getting an error
ImproperlyConfigured at /admin/
AUTH_USER_MODEL refers to model 'ledger.User' that has not been installed
I am only getting it on my production server. Not when I run things via localhost. First it was only when I was making a certain request. Then I thought my database must be out of sync so I deleted all the tables and then ran manage.py syncdb. Now, it seems to have propogated and even going to the admin throws the error.
I have never seen this error before and can't figure out what the deal is. I have defined the AUTH_USER_MODEL in settings.py:
...
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'ledger',
'extension',
'plugin',
'social.apps.django_app.default',
)
AUTH_USER_MODEL = 'ledger.User'
...
models.py:
...
class User(AbstractUser):
def __unicode__(self):
return self.username
balance = models.IntegerField(default=0)
total_pledged = models.IntegerField(default=0)
last_pledged = models.ForeignKey('Transaction', related_name='pledger', blank=True, null=True)
extension_key = models.CharField(max_length=100, null=True, blank=True)
plugin_key = models.CharField(max_length=100, null=True, blank=True)
ghosted = models.BooleanField(default=False)
def save(self, *args, **kwargs):
print('saving')
try:
self.company.save()
except:
print('no company')
super(User, self).save(*args, **kwargs)
...
This error can appear if any one of your other apps fails to load - even if it has nothing to do with the custom user model. In my case, I had the 'gcharts' app installed but needed to install the google-visualization-python library with it. Neither have anything to do with the user model, but django returned this error regardless.
The following should reveal the true root cause of your issue: