dzervas
dzervas

Reputation: 258

Deploy pure python to heroku

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'

Upvotes: 2

Views: 3524

Answers (2)

gregorio099
gregorio099

Reputation: 144

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.

Upvotes: 1

jdotjdot
jdotjdot

Reputation: 17052

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.

Upvotes: 14

Related Questions