I have an app that uses django_mongodb_engine
and mongolab
(no python manage.py syncdb required). I also am using foreman
as my local server.
Procfile:
web: gunicorn <appname>.wsgi
I have the the following custom user model called Registration
:
class Registration(AbstractBaseUser):
username = models.CharField(max_length=50)
email = models.CharField(max_length=50)
created_at = models.DateTimeField()
zone = models.IntegerField()
objects = RegistrationManager()
USERNAME_FIELD = 'username'
REQUIRED_FIELDS = ['created_at', 'zone']
Now when I type in foreman start
, it works exactly how I wanted it to be. That is USERNAME_FIELD
as not unique
, but when I try it with python manage.py runserver
, while validating models it gives me the following error:
CommandError: The USERNAME_FIELD must be unique. Add unique=True to the field parameters.
When I deploy it on Heroku it works fine.