简体   繁体   中英

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?

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.

I have a sample Django application that I've deployed to Heroku here: https://github.com/synedra/django-linkedin-simple

I have a blog post on deploying this system to heroku here: http://www.princesspolymath.com/princess_polymath/?p=511

Note that my post was more about getting the auth working. The Heroku Django tutorial itself (linked from my blog post) should be more than sufficient. You might walk through that and then see where your setup differs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM