【问题标题】:Heroku django app createsuperuserHeroku django 应用程序创建超级用户
【发布时间】:2014-03-31 15:39:03
【问题描述】:

我部署了我的 django 应用程序,当我尝试时

heroku run python manage.py syncdb

我收到超时等待进程错误。尚未为系统创建超级用户,尽管我使用了 syncdb:

heroku run:detached python manage.py createsuperuser

但这不会提示我选择超级用户。

端口 5000 在我的系统中未被阻止。如何让 heroku run 工作(或)如何创建超级用户?

【问题讨论】:

  • 检查你的日志heroku logs,你的requirements.txt可能有问题
  • 另外,创建超级用户的语法是:createsuperuser,不带空格
  • @fasouto:我对 requirements.txt 没有意见。该应用程序正在运行,我也做了syncdb。唯一的问题是我无法创建超级用户。
  • 这看起来好像您无法连接,因为您似乎在做正确的事情。你能跑heroku logs吗?

标签: django heroku django-manage.py


【解决方案1】:

不要分离 heroku shell:

heroku run python manage.py createsuperuser

为我工作

【讨论】:

  • 请务必使用heroku run python manage.py migrate 迁移数据库,只有在调用createsuperuser 命令之前未迁移数据库时才需要这样做。
【解决方案2】:

在浪费了一整天之后我得到了答案

heroku run python manage.py syncdb

不在研究所或办公室局域网上运行,您还必须删除系统代理

 unset http_proxy
`unset https_proxy`

我希望这会有所帮助

【讨论】:

    【解决方案3】:

    试试

    heroku run python manage.py shell
    

    然后从那里创建您的超级用户。祝你好运!

    【讨论】:

    • 尝试heroku run bash,然后执行python manage.py shell
    • 任何使用 heroku 运行的东西都会超时
    【解决方案4】:

    请提供更多信息。
    您使用的是什么数据库?
    您是否设置了 local_settings.py?
    你在用 Debian 吗?

    我在 Debian 上使用 Postgres,所以我必须同时使用 apt-get install python-psycopg2(否则不能使用 postgres)和 pip install --user psycopg2(否则 pip freeze 错过 Postgres),然后手动创建用户和数据库。将 USER 替换为 local_settings.py 中的用户名

    sudo su - postgres
    createuser USER -dPRs
    createdb --owner USER  db.db
    

    【讨论】:

      猜你喜欢
      • 2021-10-13
      • 2016-01-21
      • 2017-09-28
      • 1970-01-01
      • 2012-12-13
      • 2021-11-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多