Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

psycopg2.errors.UndefinedTable: relation "users_customuser" does not exist #53

Closed
denism89 opened this issue Jun 5, 2020 · 1 comment

Comments

@denism89
Copy link

denism89 commented Jun 5, 2020

Have finished first book and started second one. Hagin a great time and really enjoying material but i reached the dead end and hence i am writing here.

As I was following the book and coding along i came across the error right after i enter the username after createsuperuser command.

PS C:\Users... \books> docker-compose exec web python manage.py createsuperuser
Username: dm
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 86, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.UndefinedTable: relation "users_customuser" does not exist
LINE 1: ...is_active", "users_customuser"."date_joined" FROM "users_cus...
The above exception was the direct cause of the following exception:
....

I tried to solve it myself and didnt go well. Then shut down docker and deleted the project folder and started form beginning. And then i came across the same problem. i then used the code provided here at github and same problem keeps occurring.

Any suggestions/ideas how to explore this error further and where to find resolution?

@wsvincent
Copy link
Owner

Hi @denism89, The users database table is not created for some reason. Good that you tried shutting everything down and starting from scratch, which is always my first step :)

Have you run migrate on the database before trying createsuperuser? That's the issue here, the table for users isn't there, though I'm not completely sure why.

Closing for now. Reopen if you're continuing to have issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants