How can I modify Procfile to run Gunicorn process in a non-standard folder on Heroku?

heroku procfile python
heroku worker procfile
heroku procfile multiple commands
procfile declares types -> (none)
heroku gunicorn: command not found
no web processes running heroku flask
run gunicorn from python
deploy flask app to heroku

I'm new to heroku and gunicorn so I'm not sure how this works. But I've done some searching and I think I'm close to deploying my Django app (1.5.1). So I know I need a Procfile which has

web: gunicorn app.wsgi

Because my directories are a bit different. I can't run gunicorn in the root directory

app_project
    requirements/
    contributors/
    app/
        app/
            settings/
            wsgi.py
        # Normally Procfile goes here
    Procfile

Normally app/ would be the root directory, but I decided to structure my folders this way to separate my django app from some other things. Since I have to put the Procfile in the root directory for heroku to recognize it, what should I put in the Procfile and/or what parameters should I place in the gunicorn command?

Note:

web: gunicorn app.wsgi # won't work because Procfile is in a directory above
                       # I also want to keep the directories as is
                       # I also don't want to create a secondary git inside the app folder just for heroku
web: gunicorn app.app.wsgi # won't work because I don't want to convert the folder into a python module

Try:

web: gunicorn --pythonpath app app.wsgi

The Procfile, Remember, that the Procfile is simply used by Heroku to start processes. The generic names of the folders in the OP's question can obscure the syntax of the  In our case, we’ll use our Procfile to tell Heroku to run a Gunicorn server. The good news is Django comes with out-of-the-box support for Gunicorn servers, because they both follow the

Python Crash Course: A Hands-On, Project-Based Introduction to , Each process type declares a command that is executed when a dyno of that You can use a Procfile to declare a variety of process types, including: No process types besides web and release have special properties. the language and creates a default web process type to boot the application server. In all the tutorials I found they suggested to create the Procfile to deploy to heroku with the following line: web: gunicorn ProjectName.wsgi --log-file - Since I'm using Django 1.8 and in sett

I made a ugly hack for getting this working. So I'm going to post my answer, but I hope you guys can come up with a better solution

Procfile

web: sh ./app/run.sh

app_project/app/run.sh

#!/bin/bash

cd app
gunicorn app.wsgi

python How can I modify Procfile to run Gunicorn process in a non , How can I modify Procfile to run Gunicorn process in a non-standard folder on Heroku? - I'm new to heroku and gunicorn so I'm not sure how this works. But I've​  web: gunicorn app.wsgi # won't work because Procfile is in a directory above # I also want to keep the directories as is # I also don't want to create a secondary git inside the app folder just for heroku web: gunicorn app.app.wsgi # won't work because I don't want to convert the folder into a python module

If your file is nested in folders, the following will make more sense.

Instead of adding the path to the PYTHONPATH environmental variable, instead I referenced it like you would reference modules in a package:

In my case, the app object was in a scriptC.py, inside folderB, which is inside the folderA.

web: gunicorn folderA.folderB.scriptC:app

Deploying Django to Heroku: Procfile, STATIC_ROOT, & Other Pitfalls, Procfile ➀ ➁ # Heroku settings cwd = os.getcwd() if cwd == '/app' or cwd[:4] { '​default': dj_database_url.config(default='postgres://localhost') } # Honor the During the build process, the project runs from a temporary directory that starts with /tmp. In a local deployment, the directory is usually the name of the project folder  How can I modify Procfile to run Gunicorn process in a non-standard folder on Heroku? Next article Find a string of text in an element and wrap some span tags round it

Deploy your website on Heroku · Django Girls Tutorial: Extensions, python How can I modify Procfile to run Gunicorn process in a non standard folder on Heroku? #!/bin/bash cd app gunicorn app.wsgi web: sh ./app/run.sh. I have checked my projects that were deployed to heroku - their Procfile file contains the gunicorn line only, without python manage.py runserver. Not sure if this is the problem, though. And I also did not use django-heroku, that is why I asked about requirements – awesoon May 3 '18 at 14:55

Deploying Gunicorn, Using Django's typical naming scheme, I'm going to call our project mysite . In our case, we'll use our Procfile to tell Heroku to run a Gunicorn server. If not, find where you typed git init earlier and in that folder remove the Now, you won'​t bog down the deployment process with your log and cache files. Create a Procfile (Process File) Each Django app deployed to Heroku requires a Procfile. Navigate to the root of the project and run: Documents/first_django_app> new-item Procfile Do not make the Procfile a text file. Open the Procfile in an editor (eg Notepad) and paste the following into your Procfile: web: gunicorn first_django_app.wsgi

Why not try deploying your site to Heroku, as well as PythonAnywhere? (​myvenv) $ pip install dj-database-url gunicorn whitenoise. After the installation is finished, go to the djangogirls directory and run this command: Open up your code editor, create a file called Procfile in djangogirls directory and add this line: To successfully deploy a machine learning model with Flask and Heroku, you will need the files: model.pkl, app.py, requirements.txt, and a Procfile. This article will go through how to create each of these required files and finally deploy the app on Heroku. The main sections of this post are as follows: Create GitHub Repository (optional)

Comments
  • I'm curious... why is it that you don't want add an init.py file to the top level app/ folder?
  • I've tried to add __init__.py to the top level directory in the same project layout and it doesn't resolve all errors. Even though you pass the project import error, then there comes settings import error, because they are not in python path. So Graham's solution is the probably the best available.
  • I literally just spent half an hour looking for a workaround. Thank you!
  • @ansimionescu call yourself lucky! :)
  • Another guy who saved my day! <3
  • Man, if you were close I'd buy you a drink! I've spent hours on this!
  • A big thanks to u @graham Dumpleton ... i am new to heroku ... i am breaking my head with this issue from past two days....
  • Excellent explanation of each of the different arguments
  • Thank you for elaborating on why the accepted answer works. Much appreciated!
  • Simplest answer. Thanks! 🎉