Apache mod_wsgi python variable persistance

birdmw

For some time I have been using mod_wsgi with global variables. The global vars have been persistant across sessions in the past. Suddenly now they are not persistant. Each request loads a fresh instance and persistence is lost.

I want to enforce wsgi (for now) remembering the variables from previous requests. Is there an Apache config option such as daemon option or middleware that can enforce the behavior I had going previously?

Graham Dumpleton

It sounds like the issue may be that you were using daemon mode of mod_wsgi previously, with default of a single process, and then mucked up the Apache/mod_wsgi configuration and have fallen back to use embedded mode of mod_wsgi, which means you are subject to whatever Apache configuration is. The Apache configuration is generally multiprocess though.

See:

So confirm whether you are working in embedded mode or daemon mode.

You can also verify whether in multi process or multi threaded configuration.

You can also do:

import mod_wsgi
print(mod_wsgi.maximum_processes)
print(mod_wsgi.threads_per_process)

to confirm what configuration you are running under.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Python BaseHTTPServer vs Apache and mod_wsgi

Getting Flask to use Python3 (Apache/mod_wsgi)

running django python 3.4 on mod_wsgi with apache2

Django, apache and mod_wsgi

Apache mod_wsgi and Qt

Apache, Django and mod_wsgi

In production, Apache + mod_wsgi or Nginx + mod_wsgi?

apache/mod_wsgi - how to configure mutiple webapps using different python virtual environments

Install mod_wsgi on Ubuntu with Python 3.6, Apache 2.4, and Django 1.11

Python mod_wsgi write to custom log file instead of apache error_log

Apache2 whith mod_wsgi python3 'TypeError:' and return error 500

multiple django sites with apache & mod_wsgi

Several processes with Apache and mod_wsgi

How to install mod_wsgi into Apache on Windows?

HTTP Streaming with Apache mod_wsgi

Setup Django with apache using mod_wsgi

Django apache configuration with mod_wsgi module

apache mod_wsgi error with django in virtualenv

Apache 2.2/Redhat 2.6 with mod_wsgi

Deploying Django on Apache with mod_wsgi

Why does server response body include extra characters inserted before every character? (Apache2 / mod_wsgi / python 2.7)

Impossible to import flask_cors with apache2, mod_wsgi under Python3.5 on a Raspberry pi

Using Anaconda python with mod_wsgi

python 3.4 mod_wsgi error installing

Django and mod_wsgi python versions?

Deploying django(python) project with mod_wsgi

Running a mod_wsgi (Flask) app and a non mod_wsgi app on same Apache server

MOD_WSGI : "SERVER_NAME"( of php) equivalency in Python or WSGI?

Asking for advice on Django deployment settings with Apache and mod_wsgi