Django Heroku推送失败 [英] Django Heroku push failing

查看:131
本文介绍了Django Heroku推送失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到一个错误,试图将Django项目推到Heroku,我一直在寻找是否有人有任何见识.

I'm running accross an error trying to push my Django project up to Heroku and I was looking to see if anyone had any insight.

 !     Heroku push rejected, no Cedar-supported app detected

我猜这是因为我在git repo中的文件夹结构,但是我不确定.我的项目是这样设置的:

I am guessing it is because of my folder structure in the git repo but I am not sure. My project is setup like this:

/subfolder/djangoproject/

/subfolder/requirements.txt

我的Proc文件内容如下:

My Proc file content looks like this:

web: python manage.py runserver 0.0.0.0:$PORT --noreload --settings=djangoproject.settings.heroku

我将项目设置拆分了,它们在我的本地计算机上可以正常工作. (换句话说,我有一个包含 init .py的设置目录.)

I have my project setting split and they work fine on my local. (In other words I having a setting directory with an init.py in it.)

我尝试过:

/Procfile

和这个:

/subfolder/Procfile

但都不起作用.

此文件夹结构可以成为罪魁祸首吗?我的印象是,requirements.txt是Heroku如何找到项目文件夹的位置.

Can this folder structure be the culprit? I was under the impression that the requirements.txt was how Heroku found where the project folder was.

谢谢

我想为我遇到的第一个问题添加解决方案,然后发布我遇到的新问题.

I wanted to add my solve for the first issue I had and then post the new issue I am having.

我首先解决的问题是将Procfile和requirements.txt文件移动到项目的根目录.我做的第二件事是在其中编辑Procfile,以便manage.py脚本的路径是正确的位置

The solve I first did was to move the Procfile and requirements.txt files to the root level of the project. The second thing I did was edit the Procfile in so the path to the manage.py script was to the proper location

web: python subfolder/djangoproject/manage.py runserver 0.0.0.0:$PORT --noreload --settings=djangoproject.settings.heroku

尝试运行syncdb时,我遇到了一个新错误.它似乎经历了整个过程,但是什么也没做.换句话说,如果我运行一次syncdb,然后再次运行它,它想重新设置所有内容.关于我可能配置错误的任何想法,使数据库无法保存其数据?我应该从仪表板使用数据库的设置,还是将这一行保留在Django配置中?

I've hit a new error now when trying to run a syncdb. It seems to go through the process but nothing takes. In other words, if I run syncdb once and then run it a second time, it wants to set everything up all over again. Any thoughts on what I may have configures wrong to make the DB not save it's data? Should I use the setting for the DB from the dashboard or keep this line in the Django config:

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

谢谢

推荐答案

您需要在存储库的根目录中输入requirements.txt或setup.py.

You need requirements.txt or setup.py in the root of the repo.

请参见 https://github.com/heroku/heroku -buildpack-python/blob/master/bin/detect

这篇关于Django Heroku推送失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆