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

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

问题描述

Django有哪些基本步骤可用于故障排除和缩小 django.db.utils.ProgrammingError:关系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能够根据此问题。基本上,需要将PostgreSQL特权重新授予db用户。就我而言,那是我在虚拟环境设置文件中设置的用户。从命令行(或在postgres中)运行以下命令,其中 mydatabase dbuser 应该是您自己的数据库和用户名:

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天全站免登陆