D
D
Diabo1ic2016-04-28 00:01:13
Django
Diabo1ic, 2016-04-28 00:01:13

How to properly configure mod_wsgi?

Bundle apache2.4 + Django + mod_wsgi
Starting the djagno server with a command,
python manage.py runserver
works fine.
If I run it through Apache, then any editable information in the view is not immediately displayed. I don't understand the reason for the problem. Possible caching. Need help solving the problem.
View for dough

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()

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stepan Krapivin, 2016-04-28
@xevin

Set apache settings to
MaxRequestsPerChild 1

V
Vadim Shandrinov, 2016-04-28
@suguby

"Displayed not immediately" - very subjective. Server on local machine?
How did you set up the python environment for mod_wsgi? config to the studio.
What's in the Apache logs?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question