Forums

How can I update the database in Postgres from PythonAnywhere?

I uploaded my site with its database, it has 4 tables, now I want to update that database so that it has 6 tables, how is that done? because I used this command: python managers.py makemigrations and then python managers.py migrate and those tables were not created. Also follow this page: https://help.pythonanywhere.com/pages/PostgresGettingStarted/ but this is to create it, not to update the database

Did you see your changes to the models reflected in migration files? Is it a new app or new models in existing one?

Well, in some models I have seen the changes reflected, in others I have not. In fact, the error it seems more like the tables have not been created. About the project, yes, they are new applications that I am adding to the project and from there a new table is added

did you add that app to django settings?

yes, for example I have this in settings.py:

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'documentacion',
'obligados_solidarios',
'bienes_inmuebles'  ]

and the error appears like this:

ProgrammingError at /documentos/    relation "documentacion_documento" does not exist LINE 1: ..."."alias", "documentacion_documento"."fecha" FROM "documenta...

But I don't understand why that error appears if in the pythonanwhere console I used python manage.py makemigrations and python manage.py migrate

If migrations that you think you have are not being applied, check to make sure that the migrations that you expect are actually in your Django project.

Yes, in fact I uploaded the migration files that I had in my local project and when I uploaded the migrations, I applied python manager.py makemigrations and python manager.py migrations from the console

Did that solve your issue, or are you describing what you did before?

Yes, I did what you mentioned but it didn't work. D:

Were there any errors when you can the migrate command?