在Heroku上部署现有的Django应用程序

Chr*_*ris 12 python git django heroku

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

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'
Run Code Online (Sandbox Code Playgroud)

在Heroku文件夹中我有我的init,settings,manage和urls.py然后我有文件夹OmniCloud_App,它包含特定应用程序的管理员,模型,模板(文件夹),静态(文件夹),测试,网址和视图.为什么Heroku不认识这个应用程序?

Cra*_*ens 19

克里斯,

特别是对于Django,Heroku希望您检查Django项目所在的目录(此目录应与您的requirements.txt处于同一级别).ls可能看起来像:

$ ls
requirements.txt appfolder
$ ls appfolder
__init__.py   manage.py   settings.py    urls.py
Run Code Online (Sandbox Code Playgroud)

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

  • 对于可能遇到此问题的其他任何人,我也收到了"未检测到Cedar支持的应用程序"错误.事实证明,我忘了将我的requirements.txt添加到提交中. (7认同)