简体   繁体   English

Django Heroku推送失败

[英]Django Heroku push failing

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. 我遇到一个错误,试图将我的Django项目推送到Heroku,我一直在寻找是否有人有任何见识。

 !     Heroku push rejected, no Cedar-supported app detected

I am guessing it is because of my folder structure in the git repo but I am not sure. 我猜这是因为我的文件夹结构在git repo中,但是我不确定。 My project is setup like this: 我的项目是这样设置的:

/subfolder/djangoproject/

/subfolder/requirements.txt

My Proc file content looks like this: 我的Proc文件内容如下所示:

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

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.) (换句话说,我有一个带有init .py的设置目录。)

I tried this: 我尝试了这个:

/Procfile

and this: 和这个:

/subfolder/Procfile

but neither worked. 但都没有奏效。

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. 我的印象是,requirements.txt是Heroku如何找到项目文件夹的位置。

Thanks 谢谢


I wanted to add my solve for the first issue I had and then post the new issue I am having. 我想为我遇到的第一个问题添加解决方案,然后发布我遇到的新问题。

The solve I first did was to move the Procfile and requirements.txt files to the root level of the project. 我首先解决的问题是将Procfile和requirements.txt文件移至项目的根目录。 The second thing I did was edit the Procfile in so the path to the manage.py script was to the proper location 我做的第二件事是在其中编辑Procfile,以便manage.py脚本的路径是正确的位置

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

I've hit a new error now when trying to run a syncdb. 我在尝试运行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. 换句话说,如果我运行一次syncdb,然后再次运行它,它想重新设置所有内容。 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: 我应该使用仪表板中的数据库设置还是将这一行保留在Django配置中:

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

Thanks 谢谢

You need requirements.txt or setup.py in the root of the repo. 您需要在存储库的根目录中有requirements.txt或setup.py。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM