Too many redirects error, mod_wsgi apache and django (python-venv)
I have a problem, with django and apache (mod_wsgi), I get the browser error "too many redirects". Here my files and apache configuration
sito.urls
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('', include('sito.urls')),
path('admin/', admin.site.urls),
path('display_pingaction/', include('sito.urls')),
path('display_config/', include('sito.urls')),
]
project.urls
from django.urls import path
from sito import views
urlpatterns = [
path('', views.index, name='index'),
path('display_config/', views.display_config, name='display_config'),
path('display_pingaction/', views.display_pingaction, name='display_pingaction'),
]
views.py
from django.http import HttpResponse
from django.shortcuts import render
from django.template import loader
from .models import PingAction, Config
from . import views
def index(request):
return HttpResponse("Hello, world.")
def display_config(request):
config_list = Config.objects.all()
template = loader.get_template("display_config.html")
context = {
"config_list": config_list,
}
return HttpResponse(template.render(context, request))
httpd.conf
WSGIScriptAlias /app-web /mnt/data/Workspace/app/app-web/djangoProject/djangoProject/wsgi.py
WSGIPythonHome /mnt/data/Workspace/app/app-web/app-web-env
WSGIPythonPath /mnt/data/Workspace/app/app-web/djangoProject
<Directory "/mnt/data/Workspace/app/app-web/djangoProject">
<Files wsgi.py>
Require all granted
</Files>
</Directory>
When I navigate to http://localhost/app-web/ I get correcty "Hello, world.", but if I want the display_config page (http://localhost/app-web/display_config) the browser show me the "too many redirects" error.
If I use
python manage.py runserver
and navigate to http://127.0.0.1:8000/app-web/display_config all works correcty.
Can somebody help me please to understand what's wrong? Thank a lot