【问题标题】:Deploy Django cms on Heruku在 Heroku 上部署 Django cms
【发布时间】:2013-07-05 00:06:29
【问题描述】:

我正在尝试在 Heruku 上部署 Django CMS。 我按照https://devcenter.heroku.com/articles/git 的说明进行操作 - 但是当我运行最后一个命令时,结果如下:

(web1)users-imac:1web user$ git push heroku master
Counting objects: 453, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (439/439), done.
Writing objects: 100% (453/453), 1.21 MiB | 105 KiB/s, done.
Total 453 (delta 30), reused 0 (delta 0)

-----> Removing .DS_Store files

! Push rejected, no Cedar-supported app detected

To git@heroku.com:intense-oasis-8026.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:intense-oasis-8026.git'

所以我猜出了点问题,不确定是什么。

那些我的heroku登录输出:

 2013-07-07T14:20:41.610222+00:00 heroku[api]: Enable Logplex by alex.garulli@gmail.com
 2013-07-07T14:20:41.623083+00:00 heroku[api]: Release v2 created by alex.garulli@gmail.com
 2013-07-07T14:21:18+00:00 heroku[slug-compiler]: Slug compilation started
 2013-07-07T14:21:21+00:00 heroku[slug-compiler]: Slug compilation failed: no Cedar-supported app detected
 2013-07-07T14:22:25.296159+00:00 heroku[router]: at=info code= desc="Blank app"    method=GET path=/ host=intense-oasis-8026.herokuapp.com fwd="86.161.229.49" dyno= connect=   service= status=502 bytes=
 2013-07-07T14:22:25.474698+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/favicon.ico host=intense-oasis-8026.herokuapp.com fwd="86.161.229.49" dyno= connect= service= status=502 bytes=
 2013-07-07T21:53:38.496649+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/ host=intense-oasis-8026.herokuapp.com fwd="120.168.1.115" dyno= connect= service= status=502 bytes=
 2013-07-07T21:53:48.291460+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/favicon.ico host=intense-oasis-8026.herokuapp.com fwd="120.168.1.115" dyno= connect= service= status=502 bytes=
 2013-07-07T21:53:51.282218+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/favicon.ico host=intense-oasis-8026.herokuapp.com fwd="120.168.1.115" dyno= connect= service= status=502 bytes=
 2013-07-08T18:29:16+00:00 heroku[slug-compiler]: Slug compilation started
 2013-07-08T18:29:17+00:00 heroku[slug-compiler]: Slug compilation failed: no Cedar-  supported app detected

好的,我的 Procfile 工作正常,工头开始

20:30:16 web.1  | started with pid 13580
20:30:16 web.1  | /usr/local/foreman/bin/foreman-runner: line 41: exec: gunicorn: not  found
20:30:16 web.1  | exited with code 127 
20:30:16 system | sending SIGTERM to all processes
SIGTERM received

但 git push heroku master 的结果相同

更新

我猜我的 git push heroku master 工作了……或者至少加载了很多东西……但我知道我的页面中有

应用程序错误 应用程序发生错误,无法提供您的页面。请重试>>稍后。

如果您是应用程序所有者,请查看您的日志以了解详细信息。

不知道该怎么办......

更新

很抱歉,但无法将它推到 heroku 上

你可以在https://bitbucket.org/agarulli/trydj/src查看我的所有代码

有什么想法吗?

【问题讨论】:

  • 您的requirements.txt 中有什么内容?

标签: django heroku django-cms


【解决方案1】:

这是因为 Heroku 无法理解这是什么类型的应用程序,或者您无权访问该 git 存储库。

您需要做的就是将您的 SSH 密钥添加到您的帐户中以使其正常工作,因为这可能是问题所在。

如果这不起作用,请尝试变基。

如果您正确配置了 Heroku,能否向我们提供有关您的配置的更多信息?如果您完全是 git 新手,那么我建议您在尝试之前了解它的工作原理。

另外,请务必将 requirements.txt 发送到 heroku。

【讨论】:

    【解决方案2】:

    您的项目根文件夹中有requirements.txt 吗?没有它,Heroku 将无法理解您要安装 Python 应用程序。

    【讨论】:

    • 我有这个和一个 procfile.txt
    • 你需要 Procfile 而不是 procfile.txt
    【解决方案3】:

    确保您已按照本文所述在您的计算机上设置 SSH 密钥:https://devcenter.heroku.com/articles/keys,然后您可以按照本文:https://devcenter.heroku.com/articles/django 在 Heroku 上部署 Django。

    你能分享heroku logs命令的输出吗?

    【讨论】:

    • 我猜问题出在 Procfile 中。因为当我运行工头启动时给了我:错误:Procfile 不存在。我把我的Procfile.在 manage.py 所在的文件夹中,在我的 requirements.txt(由 pip freeze > requirements.txt 生成)旁边
    • 这是我的 Procfile。内容:网络:gunicorn ftlom.wsgi -b 0.0.0.0:$PORT
    【解决方案4】:

    确保 gunicorn & dj-database-url 在您的 requirements.txt 文件中,并将其添加到您的 settings.py 文件中:

    INSTALLED_APPS = (
        ...
        'gunicorn',
        ...
    )
    
    import dj_database_url
    DATABASES['default'] = dj_database_url.config()
    

    然后选择一个并像这样更改您的 Procfile:

    web: gunicorn YOUR_PROJECT_NAME.wsgi -b 0.0.0.0:$PORT
    

    (将 YOUR_PROJECT_NAME 更改为您的项目名称)

    web: python manage.py runserver 0.0.0.0:$PORT --noreload
    

    (如果您不想使用 Gunicorn 服务器)。

    通过使用 Virtualenv 运行以下命令来重新创建一个新的存储库和新的 cedar:

    workon YOUR_PROJECT
    pip freeze > requirements.txt
    rm -rf .git
    git init
    git add .
    git commit -am "YOUR COMMIT"
    heroku create --stack cedar
    git push heroku master
    

    使用此命令同步您的数据库:

    heroku run python manage.py syncdb
    

    打开您的应用程序:

    heroku open
    

    【讨论】:

    • 是的,如果您想使用 gunicorn,否则只需在您的 Procfile 上使用 web: python manage.py runserver 0.0.0.0:$PORT --noreload。顺便说一句,你试过我的答案了吗?
    • 是的,我已经尝试过......我想我正在将文件推送到 heroku,但是当我打开它时仍然出现应用程序错误
    • 当我推送时我可以看到这个问题:成功安装了 Django PIL South cmsplugin-filer django-classy-tags django-cms django-filer django-mixins django-mptt django-polymorphic django-sekizai easy- thumbnails gunicorn html5lib 六 清理... -----> 收集静态文件 Traceback (最近一次调用最后): OSError: [Errno 30] Read-only file system: '/static' !运行 manage.py collectstatic 时出错。更多信息:devcenter.heroku.com/articles/django-assets - 你认为这会导致问题吗?
    猜你喜欢
    • 2017-06-24
    • 1970-01-01
    • 2013-09-30
    • 1970-01-01
    • 2014-09-12
    • 2017-05-06
    • 2020-07-11
    • 2021-07-30
    • 1970-01-01
    相关资源
    最近更新 更多