Configuring the WSGI server with a Procfile on Elastic Beanstalk - Amazon Elastic Beanstalk
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Configuring the WSGI server with a Procfile on Elastic Beanstalk

You can add a Procfile to your source bundle to specify and configure the WSGI server for your application. You can specify custom start and run commands in the Procfile.

When you use a Procfile, it overrides aws:elasticbeanstalk:container:python namespace options that you set using configuration files.

The following example uses a Procfile to specify uWSGI as the server and configure it.

Example Procfile
web: uwsgi --http :8000 --wsgi-file application.py --master --processes 4 --threads 2

The following example uses a Procfile to configure Gunicorn, the default WSGI server.

Example Procfile
web: gunicorn --bind :8000 --workers 3 --threads 2 project.wsgi:application
Notes
  • If you configure any WSGI server other than Gunicorn, be sure to also specify it as a dependency of your application, so that it is installed on your environment instances. For details about dependency specification, see Specifying dependencies using a requirements file on Elastic Beanstalk.

  • The default port for the WSGI server is 8000. If you specify a different port number in your Procfile command, set the PORT environment property to this port number too.