Issue
I had mistakenly deleted my migration folders for all my apps in my project. I therefore had to redo makemigrations
and migrate
for each of those apps. When thence I try to access the specific areas with relational paths I get an error.
relation "libman_classbooks" does not exist
When I try to make some changes on the models, save and try to run makemigrations
and migrate
. this does not go on well but returns.
django.db.utils.ProgrammingError: relation "libman_classbooks" does not exist.
I have been forced to guess that I need to manually create the tables in the database. Using CREATETABLE. I don’t know if this is the best option though.
So I think my option may be possible in development thro’ the pgAdmin, but what about in production? If CREATETABLE is the best option to take, how will I do it for the production database??. I already have data in my database which do not need interference.
Solution
Answer –
- To resolve this issue, you have to comment
'django.contrib.admin'
this line in setting.py in installed app section, and then run commanddocker exec -it <db-container name or ID> psql -U postgres
and check your database is exist or not if exist then Drop the DB and create new DB with same name. - After creating DB again run docker-compose up Now it will work and again uncomment the line which was commented in settings.py
- Another approach In case if it is not working add this line in settings.py in installed app section
'app.apps.AppConfig'
then run docker- compose up it will work for you.
Answered By – nikhil upadhyay
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0