2
votes

I "finished" a little python project and I want to deploy it on heroku GitHub page. I want to execute: python2 main.py -i json-rpc in order to have the json-rpc server listening for connections but I get the following error when pushing to heroku:

$ git push heroku master Counting objects: 153, done. Delta compression using up to 8 threads. Compressing objects: 100% (87/87), done. Writing objects: 100% (153/153), 43.42 KiB, done. Total 153 (delta 61), reused 153 (delta 61)

-----> Heroku receiving push ! Heroku push rejected, no Cedar-supported app detected

To [email protected]:panager.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to '[email protected]:panager.git'

2
Did you remember to actually create a Heroku app to push to? (Either on the heroku site, but preferably through the command line.) If not, go to the main folder of your project, and run the heroku toolbelt command heroku create, and then try git push heroku master. - jdotjdot
FYI, you're also missing the requirements.txt necessary for Heroku to install Python dependencies you might need. Have you read Getting Started with Python on Heroku? - jdotjdot
yes I did. I destroied and recreated the app several times... no luck... - dzervas
i do not have any requirements. all the functions that i use are standard.take a look: github.com/ttouch/panager - dzervas
Also, it looks like you're missing a virtualenv, since I don't see one on Github and there's no .gitignore to ignore it. virtualenvs are requirements for Python apps on Heroku. - jdotjdot

2 Answers

14
votes

What you might want to try doing is creating a Procfile. The full filename is Procfile, no extension, and it goes in the main directory of your project folder.

The content of that file would be:

web: python main.py -i json-rpc

Give that a shot and see if it works.

Alternatively, you may have forgotten to create a virtualenv for your app.

You should follow the instructions in Heroku's guide Getting Started with Python on Heroku

Update:

Having finally tested this myself on a fresh Heroku app, what you're missing is a requirements.txt. Even though you don't have any dependencies, you still need it. Within your virtualenv in the main project folder, run pip freeze > requirements.txt, and then git add . then git commit -m "added requirements.txt", and then push to Heroku and it should work.

1
votes

Also, make sure that requirements.txt is saved with ANSI encoding, not Unicode or UTF-8! If you're a total n00b like me you can simply open requirements.txt in Notepad, choose SAVE AS and change the "Encoding" from the drop down. I tried all of the recommendations above but my error was due to this simple encoding problem.