我对本地版本的站点做了一些更改,将模型推送到服务器,并进行了makemigration
(revampenv) sammy@samuel-pc:~/revamp$ python manage.py makemigrations gallery
Migrations for 'gallery':
0032_auto_20170829_0058.py:
- Create model Area
- Create model Color
- Create model ThumbnailCache
- Add field unique_key_string to image
- Alter field example on image
- Alter field timeline on image
工作很好,然后我试图迁移,我得到了这个错误
^{pr2}$我以前也遇到过这样或类似的错误,当时数据库数据库数据库下面有一个本地env的副本,但现在不是这样了。在
(注意)其他型号也不适用
(revampenv) sammy@samuel-pc:~/revamp$ python manage.py makemigrations account
Migrations for 'account':
0003_userprofile_bio.py:
- Add field bio to userprofile
(revampenv) sammy@samuel-pc:~/revamp$ python manage.py migrate
...
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: must be owner of relation account_userprofile
更新 试图编辑数据库所有者
postgres=# ALTER DATABASE color_db OWNER TO revamp;
ALTER DATABASE
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'color_db',
'USER': 'revamp',
'PASSWORD': 'xxx',
'HOST': 'localhost',
'PORT': '',
}
}
但它仍然返回相同的错误
(revampenv) sammy@samuel-pc:~/revamp$ python manage.py migrate
...
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: must be owner of relation account_userprofile
您需要将当前用户设置为数据库所有者。为此,您需要打开postgres shell并执行查询:
请参阅详细信息here。在
相关问题 更多 >
编程相关推荐