relation-auth-user-does-not-exist

来源:互联网 发布:python java薪资 编辑:程序博客网 时间:2024/05/17 09:44

title: 【ERROR】relation auth_user does not exist
type: categories
date: 2017-05-09 16:46:30
categories: Python

tags: [Django, Heroku, autn_user]

Django应用在本地通过heroku local web测试没有问题,但部署到Heroku后,打开admin站点,出现的relation auth_user does not exist问题。

原因

应用只在本地创建了超级管理员,但在部署到Heroku后处于生产环境,而生产环境中没有配置超级管理员。

解决

heroku run python manage.py makemigrationsheroku run python manage.py migrateheroku run python manage.py createsuperuser

执行以上指令,创建生产环境的管理员。

需要注意的是,运行 heroku run 指令,需要先指定 heroku应用,否则会一直出现 Error: No app specified 的报错,如没报错,可忽略。

指定Heroku应用的操作,如下:

# 如果存在heroku仓库,但不是当前应用,可先执行删除git remote rm heroku# 添加应用仓库到herokugit remote add heroku https://git.heroku.com/myzz.git

本文参考:http://stackoverflow.com/questions/29689365/auth-user-error-with-django-1-8-and-syncdb-migrate

0 0
原创粉丝点击