Django pg_restore在本地机器上

时间:2012-10-10 17:21:49

标签: django postgresql heroku pg-restore

  

可能重复:
  Django: permission denied when trying to access database after restore (migration)

遇到类似的问题:After a PostgreSQL restore, I get "permission denied for relation django_session"除了接受的解决方案无效之外,根据heroku docs我创建了一个备份,并将其卷曲到我的机器上,然后运行:

pg_restore -v -c -Ox -d mydb mydump.dump

最初我得到了:

django.db.utils.DatabaseError: no schema has been selected to create in

然后在psql中应用以下内容...

GRANT USAGE ON SCHEMA public TO PUBLIC;
GRANT CREATE ON SCHEMA public TO PUBLIC;

......我和上面的SO问题一样......

$ python manage.py syncdb
>>> django.db.utils.DatabaseError: permission denied for relation django_content_type

这真的让我感到震惊,正如我所尝试过的那样--no-acl&& --no-owner(-Ox)确保:

GRANT ALL PRIVILEGES ON DATABASE mydb to myuser

使用django 1.4,&安装的应用程序包括django-CMS ...此外,本地副本已经与相同的用户w /不同的postgresql数据库工作正常。

糟糕:

为制造经典错误而道歉假设我的问题是 SO 唯一;解决方案在其他地方Django: permission denied when trying to access database after restore (migration)

GRANT ALL ON ALL TABLES IN SCHEMA public to user;
GRANT ALL ON ALL SEQUENCES IN SCHEMA public to user;
GRANT ALL ON ALL FUNCTIONS IN SCHEMA public to user;

诀窍;感谢不知情的救世主:@ user698585; P

0 个答案:

没有答案