解决“django.db.utils.ProgrammingError:关系django_migrations的权限被拒绝"的步骤 [英] Steps to Troubleshoot "django.db.utils.ProgrammingError: permission denied for relation django_migrations"

查看:36
本文介绍了解决“django.db.utils.ProgrammingError:关系django_migrations的权限被拒绝"的步骤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有哪些基本步骤可以排除 Django 的django.db.utils.ProgrammingError:permission denied for relation django_migrations"错误并缩小原因范围?

What are some basic steps for troubleshooting and narrowing down the cause for the "django.db.utils.ProgrammingError: permission denied for relation django_migrations" error from Django?

我在最初是一个稳定的生产服务器之后收到此消息,但此后对 Django、Postgres、Apache 的几个方面进行了一些更改,并从 Github 拉取.此外,这些更改已经有一段时间了,我不记得或无法跟踪可能导致问题的每个更改.

I'm getting this message after what was initially a stable production server but has since had some changes to several aspects of Django, Postgres, Apache, and a pull from Github. In addition, it has been some time since those changes were made and I don't recall or can't track every change that may be causing the problem.

我在运行 python manage.py runserver 或任何其他 python manage.py ... 命令时收到消息,python manage.py check,表示系统良好.

I get the message when I run python manage.py runserver or any other python manage.py ... command except python manage.py check, which states the system is good.

推荐答案

我能够根据此

I was able to solve my issue based on instructions from this question. Basically, postgres privileges needed to be re-granted to the db user. In my case, that was the user I had setup in the virtual environment settings file. Run the following from the commandline (or within postgres) where mydatabase and dbuser should be your own database and user names:

psql mydatabase -c "GRANT ALL ON ALL TABLES IN SCHEMA public to dbuser;"
psql mydatabase -c "GRANT ALL ON ALL SEQUENCES IN SCHEMA public to dbuser;"
psql mydatabase -c "GRANT ALL ON ALL FUNCTIONS IN SCHEMA public to dbuser;"

这篇关于解决“django.db.utils.ProgrammingError:关系django_migrations的权限被拒绝"的步骤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆