Preserving state in mod_wsgi Flask application

后端 未结 2 1584
余生分开走
余生分开走 2021-01-16 16:38

I have a Flask application running under mod_wsgi that makes a connection to a database. There are multiple processes running this application (only one thread per process)

2条回答
  •  执笔经年
    2021-01-16 17:07

    Regarding sharing state between wsgi threads, there is a directive you can put in the apache virtual host configuration that allows them to be executed in the same context.

    The WSGIApplicationGroup directive can be used to specify which application group a WSGI application or set of WSGI applications belongs to. All WSGI applications within the same application group will execute within the context of the same Python sub interpreter of the process handling the request.

    Note that this is for threads within a process, not between processes.

提交回复
热议问题