User Registration with error: no such table: auth_user
./manage.py migrate
If you've just enabled all the middlewares etc this will run each migration and add the missing tables.
Only thing you need to do is :
python manage.py migrate
and after that:
python manage.py createsuperuser
after that you can select username and password.
here is the sample output:
Username (leave blank to use 'hp'): admin
Email address: [email protected]
Password:
Password (again):
Superuser created successfully.
Update
You are probably getting this error because you are using UserCreationForm
modelform, in which in META
it contains User
(django.contrib.auth.models > User) as model.
class Meta:
model = User
fields = ("username",)
And here you are using your own custom auth model, so tables related to User
has not been created. So here you have to use your own custom modelform. where in Meta class, model should be your User
(books.User) model
This will work for django version <1.7:
Initialize the tables with the command
manage.py syncdb
This allows you to nominate a "super user" as well as initializing any tables.
it is need to make migration before create superuser.
python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser
Username : admin
Password : 12345678
python manage.py runserver