How to create a Procfile for Python in Heroku?

ShaunK

I cannot seem to find a solid answer to this after scouring the web for answers. Currently, I have my directory set up this way:

flaskapp
     -app
        -intro_to_flask
              +__init__.py
              +config.py
              +routes.py
              +forms.py
        -runserver.py
        -Readme.md
     -bin
     -include
     -lib
     -view
Procfile
requirements.txt

So I not sure whether the Procfile is set up correctly...I have it set up this way:

web: gunicorn --pythonpath app runserver

However, when I run foreman start...heroku goes into a loop that keeps restarting the connection, I tried manually setting the port in the virtual environment export PORT=5001, but I am still getting the same error:

Running on http://127.0.0.1:5000/
12:21:20 web.1  |  * Restarting with reloader
12:21:20 web.1  | 2014-02-22 12:21:20 [34532] [INFO] Starting gunicorn 18.0
12:21:20 web.1  | 2014-02-22 12:21:20 [34532] [ERROR] Connection in use: ('0.0.0.0', 5001)

Also, I have killed all gunicorn processes that are in used and tried running foreman start again...any ideas what could be going on?

Here is my runserver.py

from intro_to_flask import app

app.run(debug=True)
Miguel

When you run your app on gunicorn you do not use the same starter script that starts the development server. All gunicorn needs to know is from where to import the application. In your case I think what you want in your Procfile is something like this:

web: gunicorn --pythonpath app intro_to_flask:app

Not sure if this will work as is or if you will need to make minor tweaks. The idea is that you need to give gunicorn the package or module that defines the application, then a colon, and then the application instance symbol.

I hope this helps.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Procfile in Heroku

From Dev

Procfile Heroku

From Dev

Heroku Procfile not working

From Dev

heroku $PORT variable in Procfile

From Dev

Heroku, Procfile and gitignore

From Dev

Heroku Flask Tutorial Procfile Meaning

From Dev

Heroku looking for Procfile in wrong directory

From Dev

ruby and heroku procfile for web app

From Dev

Difference between Procfile and Procfile.Windows in heroku servers

From Dev

How do you import a custom module with Gunicorn in a Procfile when deploying to Heroku?

From Dev

Django-twoscoops-project (skeleton) on Heroku via Gunicorn. How to set Procfile?

From Dev

Heroku Procfile won't run Django app

From Dev

"No Procfile detected" in Sinatra app heroku push

From Dev

Rails app using Thin and SSL on Heroku (Procfile)

From Dev

"No Procfile detected" in Sinatra app heroku push

From Dev

Heroku No such process type web defined in procfile

From Dev

Heroku: No such process type worker defined in Procfile

From Dev

Procfile not found when deploying app to heroku

From Dev

Do I need a Procfile to push a Sinatra app to Heroku?

From Dev

Heroku. New Relic Procfile command doesn't work

From Dev

What does "--log-file -" mean in Heroku procfile?

From Dev

HEROKU: ps:scale web=1 no such process type web defined in Procfile

From Dev

Heroku, Java, Procfile, Could not find or load main class

From Dev

Can we have two workers with different jobs in Procfile for Heroku?

From Dev

How do I declare process type with Procfile?

From Dev

How to filter (grep) output of a process in Procfile?

From Dev

Python with open doesn't create new file after deployed at Heroku

From Dev

"bundler: command not found: unicorn" after adding Procfile as told by Heroku Bamboo to Cedar migration guide

From Dev

Anyway to be able to push to heroku master with Procfile and requirments.txt in a seperate folder

Related Related

  1. 1

    Procfile in Heroku

  2. 2

    Procfile Heroku

  3. 3

    Heroku Procfile not working

  4. 4

    heroku $PORT variable in Procfile

  5. 5

    Heroku, Procfile and gitignore

  6. 6

    Heroku Flask Tutorial Procfile Meaning

  7. 7

    Heroku looking for Procfile in wrong directory

  8. 8

    ruby and heroku procfile for web app

  9. 9

    Difference between Procfile and Procfile.Windows in heroku servers

  10. 10

    How do you import a custom module with Gunicorn in a Procfile when deploying to Heroku?

  11. 11

    Django-twoscoops-project (skeleton) on Heroku via Gunicorn. How to set Procfile?

  12. 12

    Heroku Procfile won't run Django app

  13. 13

    "No Procfile detected" in Sinatra app heroku push

  14. 14

    Rails app using Thin and SSL on Heroku (Procfile)

  15. 15

    "No Procfile detected" in Sinatra app heroku push

  16. 16

    Heroku No such process type web defined in procfile

  17. 17

    Heroku: No such process type worker defined in Procfile

  18. 18

    Procfile not found when deploying app to heroku

  19. 19

    Do I need a Procfile to push a Sinatra app to Heroku?

  20. 20

    Heroku. New Relic Procfile command doesn't work

  21. 21

    What does "--log-file -" mean in Heroku procfile?

  22. 22

    HEROKU: ps:scale web=1 no such process type web defined in Procfile

  23. 23

    Heroku, Java, Procfile, Could not find or load main class

  24. 24

    Can we have two workers with different jobs in Procfile for Heroku?

  25. 25

    How do I declare process type with Procfile?

  26. 26

    How to filter (grep) output of a process in Procfile?

  27. 27

    Python with open doesn't create new file after deployed at Heroku

  28. 28

    "bundler: command not found: unicorn" after adding Procfile as told by Heroku Bamboo to Cedar migration guide

  29. 29

    Anyway to be able to push to heroku master with Procfile and requirments.txt in a seperate folder

HotTag

Archive