繁体   English   中英

我想在 Heroku 上部署 Django 应用程序,但出现错误

[英]I want to deploy a Django app on Heroku, but I got error

我想在 Heroku 上部署一个 Django 应用程序。

开发环境是wsl(debian),python3.9.0,虚拟环境是“venv”。

我在这里提到:
https://tutorial-extensions.djangogirls.org/ja/heroku/

它在此代码之前完成:
git push heroku master

运行git push heroku master
然后我收到以下错误:

(env) me@Ver:~/docker_heroku/djangogirls210307$ git push heroku master
Enumerating objects: 78, done.
Counting objects: 100% (78/78), done.
Delta compression using up to 4 threads
Compressing objects: 100% (64/64), done.
Writing objects: 100% (78/78), 25.08 KiB | 885.00 KiB/s, done.
Total 78 (delta 18), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Building on the Heroku-20 stack
remote:  !     No default language could be detected for this app.
remote:                         HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
remote:                         See https://devcenter.heroku.com/articles/buildpacks
remote: 
remote:  !     Push failed
remote:  !
remote:  ! ## Warning - The same version of this code has already been built: ad15f239126a3588a2ab6585b0ae52bfa25d9b7e
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version ad15f239126a3588a2ab6585b0ae52bfa25d9b7e
remote:  ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote:  !
remote:  ! If you are developing on a branch and deploying via git you must run:
remote:  !
remote:  !     git push heroku <branchname>:main
remote:  !
remote:  ! This article goes into details on the behavior:
remote:  !   https://devcenter.heroku.com/articles/duplicate-build-version
remote: 
remote: Verifying deploy...
remote: 
remote: !       Push rejected to django-210307.
remote: 
To https://git.heroku.com/django-210307.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/django-210307.git'

我已经运行heroku create
“djangogirls210307”已在 heroku 上创建。

下面的output是用heroku info --app diangogirls210307得到的信息

=== djangogirls210307
Auto Cert Mgmt: false
Dynos:          
Git URL:        https://git.heroku.com/djangogirls210307.git
Owner:          mailme@gmail.com
Region:         us
Repo Size:      0 B
Slug Size:      0 B
Stack:          heroku-20
Web URL:        https://djangogirls210307.herokuapp.com/

我还将工作目录命名为“djangogirls210307”,并在其中使用以下结构。

djangogirls210307/
|
|- env  // by "venv", not "virtualenv""pipenv"
|-mysite // name of project
 |-__init__.py
 |-asgi.py
 |-local_settings.py
 |-urls.py
 |-settings.py
 |-wsgi.py
|-.gitignore
|-manage.py
|-Procfile
|-requirements.txt
|-runtime.txt

报错中显示了'django-210307.git',但很可能是今天练习时创建的远程仓库。

所以,我想问以下几个问题。 谢谢您的合作。

  1. 我想知道部署成功完成之前的过程。
  2. 我想知道是否可以通过更改推送目的地来解决。 但是,我不明白为什么使用git push heroku master命令修复了推送目标。
  3. 我想知道如何更改和指定推送目的地。
  4. 如果您不介意在问题中使用错误的词,请告诉我。
remote: -----> Building on the Heroku-20 stack
remote:  !     No default language could be detected for this app.
remote:                         HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
remote:                         See https://devcenter.heroku.com/articles/buildpacks

手动设置 buildpack:

heroku buildpacks:set heroku/python

暂无
暂无

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

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