简体   繁体   中英

First push django in heroku

I'm trying to push my django app in heroku and I've followed all the instructions in the tutorial of heroku's page, but when i try to do the push i get this:

christian@christian-R480-R431-R481:~/Documentos/heroku/Portafolio6$ sudo git push heroku master
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (5/5), 542 bytes, done.
Total 5 (delta 0), reused 0 (delta 0)


 !     Push rejected, no Cedar-supported app detected

To git@heroku.com:mysterious-thicket-1865.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:mysterious-thicket-1865.git'
christian@christian-R480-R431-R481:~/Documentos/heroku/Portafolio6$ 

I dont know why this happens. Do I have to do the push in the django project or when i have the virtualenv folder?

Do you have a valid requirements.txt file? This file is needed by Heroku to pip install the relevant python packages that your app uses.

To auto generate this file, just run the following code:

pip freeze > requirements.txt

The requirements.txt file should reside at the top most level, adjacent to the app.

The 'Step 3 - Heroku Best Practices' section at http://www.deploydjango.com/django_project_structure/ will give you more info.

Check that you have the requirements.txt, Procfile and runtime.txt files in your directory.

To generate requirements.txt, activate your virtualenv and freeze the installed packages:

workon my_project
pip freeze > requirements.txt

Your Procfile is responsible for telling the heroku system how to run your app (and most likely is what is missing in this instance). Here is a sample:

web: gunicorn my_project.wsgi -b 0.0.0.0:$PORT

Your runtime.txt file is responsible for determining which version of python to run:

python-2.7.4

Ensure that all three files exist (technically runtime.txt is optional, but it's a good idea), are commited and then try your push again.

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