I am trying to use Cookiecutter to help me to deploy a web app with Heroku and Amazon S3.
This is an app that I developed locally without Cookiecutter so I am copy-pasting the files into the new project and debug step by step.
The original app used the build-in Django User Model so I would like to switch to the Abstract User Model that comes with Cookiecutter. I started to create a new database for this project to start from scratch.
Then I thought it would be as simple as replacing User
by AUTH_USER_MODEL
models.py
from config.settings.base import AUTH_USER_MODEL
class Category(models.Model):
name = models.CharField(max_length=30)
description = models.CharField(max_length=140,blank=True,null=True)
date_created = models.DateField(default=timezone.now)
date_updated = models.DateField(auto_now=True)
created_by = models.ForeignKey(AUTH_USER_MODEL, related_name="categories")
def __str__(self):
return self.name
I get this error when running manage.py migrate
accounts.User.user_ptr: (fields.E301) Field defines a relation with the model 'auth.User', which has been swapped out.
HINT: Update the relation to point at 'settings.AUTH_USER_MODEL'
In settings.py
AUTH_USER_MODEL = 'users.User'
Where I am missing something ?