简体   繁体   English

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

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

I want to deploy a Django app on Heroku.我想在 Heroku 上部署一个 Django 应用程序。

The development environment is wsl (debian), python3.9.0, and the virtual environment is "venv".开发环境是wsl(debian),python3.9.0,虚拟环境是“venv”。

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

It was completed before this code:它在此代码之前完成:
git push heroku master

Run git push heroku master ,运行git push heroku master
then I got the following error:然后我收到以下错误:

(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'

I've run heroku create ,我已经运行heroku create
"djangogirls210307" has been created on heroku. “djangogirls210307”已在 heroku 上创建。

The output below is the information obtained with heroku info --app diangogirls210307下面的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/

I also named the work directory "djangogirls210307" and worked with the following structure in it.我还将工作目录命名为“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

In the error,'django-210307.git' is displayed, but it is probably the remote repository created during practice today.报错中显示了'django-210307.git',但很可能是今天练习时创建的远程仓库。

So, I would like to ask the following questions.所以,我想问以下几个问题。 Thank you for your cooperation.谢谢您的合作。

  1. I want to know the procedure until the deployment is completed successfully.我想知道部署成功完成之前的过程。
  2. I want to know if it can be solved by changing the push destination.我想知道是否可以通过更改推送目的地来解决。 However, I don't understand why the push destination was fixed with the git push heroku master command.但是,我不明白为什么使用git push heroku master命令修复了推送目标。
  3. I want to know how to change and specify the push destination.我想知道如何更改和指定推送目的地。
  4. Please let me know if you don't mind if you use the wrong word in the question.如果您不介意在问题中使用错误的词,请告诉我。
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

Set a buildpack manually:手动设置 buildpack:

heroku buildpacks:set heroku/python

暂无
暂无

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

相关问题 出现错误 =&gt; ModuleNotFoundError: No module named 'django' 当我尝试将 django 应用程序部署到 heroku 时 - Getting Error => ModuleNotFoundError: No module named 'django' When I attempt to deploy my django app to heroku 尝试将Django应用程序推送到Heroku时出现以下错误:TomlDecodeError(“无效的日期或数字”) - I got the following error while trying to push my Django app to Heroku: TomlDecodeError(“Invalid date or number”) 当我将Django应用程序部署到heroku时,站点停止工作 - When i deploy my django app to heroku the site stops working 我想在我的 django 管理员上注册一个模型,但我收到了这个错误 - I want to register a model on my django admin and i got this error git push heroku master如何从git deploy迁移到容器部署在Heroku上的Django App? - git push heroku masterHow do I Migrate Django App on Heroku from git deploy to container deploy? Django 应用程序部署到 Heroku,应用程序错误, - Django app deploy to Heroku, Application Error, 将Django应用部署到Heroku - Deploy Django App to Heroku 我正在尝试将Django项目部署到heroku。 我的应用未运行,日志显示错误代码503 - I'm trying to deploy my django project to heroku. My app is not running the log shows error code 503 我无法使用Django部署到heroku - I can't deploy to heroku with django 在Heroku中部署django应用程序时,如何在gunicorn中修复erro? - How I fix erro in gunicorn when I deploy django app in Heroku?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM