Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
292 views
in Technique[技术] by (71.8m points)

python - Deploying existing Django app on Heroku

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'

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Chris,

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...