python manage.py migrate does not make any changes in the postgres database

≡放荡痞女 提交于 2019-12-05 11:58:17
Wannabe Coder

Make sure that the app containing that models.py file is included in INSTALLED_APPS of your project's settings file. In addition, please do not touch the files under the app's migration folder unless you are certain you know what you are doing. Please also make sure that the DB account specified in your settings file have the necessary privileges.

If you recently changed your Django version, this link might be of use to you. But give it a shot anyway and make the migrations per app in this case:

python manage.py makemigrations app_name

If all else fails, just drop the tables of the database, and regenerate everything from scratch. However, if at some point, you messed with any of the migration files, you might want to remove all of them before performing makemigrations to ensure that you have a new and working set of migration files that manage.py can work on.

STREET MONEY

You may need to reset your database user or owner password and try again. In mine I had to reset the default postgres user to not use any password from commandline using this link here.

Then tried running the command: python manage.py migrate and now works like charm.

Don't forget to also set your configurations from the django project: myprojectname/myprojectname/settings.py file. example here is mine;

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'polling_db',
        'USER': 'postgres',
        'PASSWORD': '',
        'HOST': '127.0.0.1',
        'PORT': '5432',
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!