How to make openshift python flask app only run with 1 process?

118 views Asked by At

My wsgi.py looks like this:

#!/usr/bin/python
import os

virtenv = os.environ['OPENSHIFT_PYTHON_DIR'] + '/virtenv/'
virtualenv = os.path.join(virtenv, 'bin/activate_this.py')
try:
    execfile(virtualenv, dict(__file__=virtualenv))
except IOError:
    pass

from myapp import app as application

Where myapp is a flask app.

Openshift seems to use mod_wsgi to host my app, but I have no idea where to config it.

For the moment it appeas to run with 2 process

1

There are 1 answers

1
Graham Dumpleton On

What is the particular reason why your application will not work when run across 2 processes?

As far as I know you can't override the fact that the OpenShift Python cartridge setup for mod_wsgi uses 2 processes.

For using mod_wsgi at least, the only solution on OpenShift would be to use mod_wsgi-express as outlined in:

This replaces the default OpenShift mod_wsgi setup and provides you control over the configuration. By default it will use a single process with 5 threads, but you can override both the number of processes and number of threads per process, as well as a whole bunch of other settings.