Heroku's Procfile
format is quite simple. As described in the documentation:
A Procfile declares its process types on individual lines, each with the following format:
<process type>: <command>
You can see that there should be a colon after the process type, so the
web gunicorn
example in your question is not going to work properly. You'll want to start the line with web:
.
<command>
indicates the command that every dyno of the process type should execute on startup, such as rake jobs:work
For Django, in development you'd typically use python manage.py runserver
to run the application, so a reasonable attempt for Django would be
web: python manage.py runserver
This should work, but it's not appropriate for production work:
DO NOT USE THIS SERVER IN A PRODUCTION SETTING. It has not gone through security audits or performance tests. (And that’s how it’s gonna stay. We’re in the business of making Web frameworks, not Web servers, so improving this server to be able to handle a production environment is outside the scope of Django.)
Instead, you should use a production-grade web server in production. Gunicorn is a common choice, and you can run your Django application with Gunicorn like so:
gunicorn myproject.wsgi
Putting that all together, a Procfile
for Django on Heroku might look like
web: gunicorn myproject.wsgi
where myproject
is the name of your Django project. This is exactly what Heroku's documentation suggests for Django applications.
Note that you'll have to add Gunicorn to your project dependencies so Heroku will install it. I recommend also installing it locally so you can use heroku local
to test your application on your dev machine in a way more similar to Heroku's production environment.
heroku ps:scale
is used to change the number and type of dynos for process types you have already defined. It has nothing to do with defining those process types. That's what your Procfile
is for.