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

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

问题描述

遵循Heroku教程,但我已经创建了一个相当复杂的Django应用程序,我想要上传。我已将它复制到一个新的文件夹,并成功发出了 git init ,并将文件添加到提交。我做 heroku创建 - 堆栈雪松所以我得到一个网站,然后发出 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天全站免登陆