How to configure mod_wsgi?

A bunch of apache2.4 + Django + mod_wsgi

Start the server djagno team
python manage.py runserver
works perfectly

If run through Apache, then any reductiona information in the view is displayed immediately. Don't understand the cause of the problem. Can be cached. Need help in solving the problem.

The view to the test
from django.http import HttpResponse
from django.views.decorators.cache import never_cache

@never_cache
def index(request):
 return HttpResponse('test')


wsgi.py
import os
import sys
from django.core.wsgi import get_wsgi_application


os.environ.setdefault("DJANGO_SETTINGS_MODULE", "main.settings")

PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.abspath(os.path.join(PROJECT_ROOT, "../")))

application = get_wsgi_application()
July 12th 19 at 17:22
2 answers
July 12th 19 at 17:24
Enter the configuration of apache
MaxRequestsPerChild 1
Added this setting in a config of Apache /etc/apache2/apache2.conf ,unchanged. The server returns the updated content of the view only after restart the server - kyra_Gerhold commented on July 12th 19 at 17:27
July 12th 19 at 17:26
"Displayed immediately" is very subjective. The server on the local machine?
How to set up python environment for mod_wsgi? config in the Studio.
In the Apache logs?
Yes, the server on the local machine. In the logs there is nothing.
The Python environment works through vierualenv
The Apache error log.log
[Thu Apr 28 14:41:19.351571 2016] [so:warn] [pid 4496] AH01574: module wsgi_module is already loaded, skipping
[Thu Apr 28 14:41:19.374542 2016] [mpm_prefork:notice] [pid 4497] AH00163: Apache/2.4.18 (Ubuntu) mod_wsgi/4.3.0 Python/3.5.1+ configured -- resuming normal operations
[Thu Apr 28 14:41:19.374601 2016] [core:notice] [pid 4497] AH00094: Command line: '/usr/sbin/apache2'



LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias / /var/www/blog/main/wsgi.py
WSGIProcessGroup site.my
WSGIDaemonProcess site.my python-path=/var/www/blog/env/lib/python3.5/site-packages

ServerName site.my


Order deny,allow
Require all granted
- kyra_Gerhold commented on July 12th 19 at 17:29

Find more questions by tags CachingDjangoPython