Skip to content

Commit ca69341

Browse files
Add gunicorn config file.
1 parent 679fce0 commit ca69341

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

.s2i/environment

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
APP_CONFIG=config.py

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ This sample Python application relies on the support provided by the default S2I
1010
* The WSGI application entry point within the code file needs to be named ``application``.
1111
* The ``gunicorn`` package must be listed in the ``requirements.txt`` file for ``pip``.
1212

13+
In addition, the ``.s2i/environment`` file has been created to allow environment variables to be set to override the behaviour of the default S2I builder for Python.
14+
15+
* The environment variable ``APP_CONFIG`` has been set to declare the name of the config file for ``gunicorn``.
16+
1317
## Deployment Steps
1418

1519
To deploy this sample Python web application from the OpenShift web console, you should select ``python:2.7``, ``python:3.3``, ``python:3.4`` or ``python:latest``, when using _Add to project_. Use of ``python:latest`` is the same as having selected the most up to date Python version available, which at this time is ``python:3.4``.

config.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import os
2+
3+
workers = int(os.environ.get('GUNICORN_PROCESSES', '3'))
4+
threads = int(os.environ.get('GUNICORN_THREADS', '1'))
5+
6+
forwarded_allow_ips = '*'
7+
secure_scheme_headers = { 'X-Forwarded-Proto': 'https' }

0 commit comments

Comments
 (0)