[英]When I tried to deploy to Heroku my Django project it is not detecting the buildpack. Could anyone help me please?
No default language could be detected for this app.
You need to specify a buildpack.您需要指定一个构建包。 It can't pick a default language because you are either missing files (eg requirements.txt
) or you have too many like Aptfile
, Gemfile
, package,json
, etc.它无法选择默认语言,因为您要么缺少文件(例如requirements.txt
) ,要么有太多文件,例如Aptfile
、 Gemfile
、 package,json
等。
So if you have requirements.txt
and package.json
it does not know if your project uses python or node or even both.因此,如果您有requirements.txt
和package.json
它不知道您的项目是否使用 python 或节点,甚至两者。
Here I am using multiple buildpacks: https://i.imgur.com/LNHZAKe.png这里我使用了多个构建包: https://i.imgur.com/LNHZAKe.png
Add the buildpacks either through CLI or through the dashboard .通过CLI或仪表板添加构建包。
did you make necessary changes in your settings.py,created Procfile, and all requirmenets packages in requirements.txt by您是否对您的 settings.py、创建的 Procfile 以及 requirements.txt 中的所有要求包进行了必要的更改?
pip freeze > requirements.txt
if not please check this link heroku django configure如果不是,请检查此链接heroku django 配置
please share your settings.py file by copying code not as screenshot what i can see it says no default language detected make sure that there is default language in your settings.py in language code请通过复制代码而不是屏幕截图来共享您的 settings.py 文件 我可以看到它说没有检测到默认语言 确保您的 settings.py 语言代码中有默认语言
You need to add a Procfile
at the root of your project with content such as您需要在项目的根目录中添加一个Procfile
,其中包含以下内容
web: gunicorn yourproject.wsgi --log-file--
You also need to specify the runtime python version to use.您还需要指定要使用的运行时 python 版本。
You do that by creating runtime.txt
at the root your project with content python-3.7.9
为此,您可以在项目的根目录中使用内容python-3.7.9
创建runtime.txt
If you didn't create one before, we need to create a requirements.txt
file to tell Heroku what Python packages need to be installed on our server.如果您之前没有创建过,我们需要创建一个requirements.txt
文件来告诉 Heroku 哪些 Python 包需要安装在我们的服务器上。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.