在 Heroku 上部署现有的 Django 应用程序 [英] Deploying existing Django app on Heroku

查看:40
本文介绍了在 Heroku 上部署现有的 Django 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

遵循 Heroku 教程,但我已经创建了一个相当复杂的 Django 应用程序,我想上传它.我已将它复制到一个新文件夹并成功发出 git init,同时将文件添加到提交中.我做 heroku create --stack cedar 所以我得到一个站点然后发出 git push heroku master.我得到以下信息:

Following the Heroku tutorial but I have already created a rather complex Django app that I want to upload. I have copied it to a fresh folder and issued git init successfully, along with adding the files to a commit. I do heroku create --stack cedar so I get a site then issue the git push heroku master. I get the following:

Counting objects: 6756, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5779/5779), done.
Writing objects: 100% (6756/6756), 6.98 MiB | 953 KiB/s, done.
Total 6756 (delta 2210), reused 0 (delta 0)

-----> Heroku receiving push
-----> Removing .DS_Store files
-----> Python app detected
 !     Django app must be in a package subdirectory
 !     Heroku push rejected, failed to compile Python app

To git@heroku.com:sitename.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:sitename.git'

在 Heroku 文件夹内,我有我的 init、设置、管理和 urls.py 然后我有文件夹 OmniCloud_App,其中包含该特定应用程序的管理员、模型、模板(文件夹)、静态(文件夹)、测试、网址和视图.为什么 Heroku 无法识别该应用?

Inside the Heroku folder I have my init, settings, manage, and urls.py then I have the folder OmniCloud_App which holds that particular app's admin, models, Templates (folder), static (folder), tests, urls, and views. Why doesn't Heroku recognize the app?

推荐答案

Chris,

特别是对于 Django heroku 期望您检查您的 Django 项目所在的目录(该目录应该与您的 requirements.txt 处于同一级别).ls 可能类似于:

Specifically for Django heroku expects you to check in the directory that your Django project lives in (this directory should live at the same level as your requirements.txt). An ls might look something like:

$ ls
requirements.txt appfolder
$ ls appfolder
__init__.py   manage.py   settings.py    urls.py

这应该允许您部署现有的应用程序,然后根据需要配置您的 Procfile.

This should allow you to deploy an existing app then configure your Procfile as needed.

这篇关于在 Heroku 上部署现有的 Django 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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