Areeba Seher
Areeba Seher

Reputation: 150

Django DreamHost - Request exceeded the limit of 10 internal redirects due to probable configuration error

I have hosted Django project on DreamHost. Everything works perfectly when I visit the homepage, but when I try to access any other page, I receive the following error message:

Example: www.example.com (Working)

www.example.com/foo/ (Getting error)

'Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.'

I have tried to solve this issue, but I have been unable to do so.

Following is my .htaccess file in /home/username/example.com/public folder.

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /electiondata_private/$1 [L,QSA]

AddHandler wsgi-script .wsgi

And my passenger.wsgi file in /home/username/example.com

import sys, os
INTERP = "/home/analyzethevote/atv/electiondata-private/venv/bin/python3"
#INTERP is present twice so that the new python interpreter 
#knows the actual executable path 
if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv)

cwd = os.getcwd()
sys.path.append(cwd)
sys.path.append(cwd + '/electiondata-private')  #You must add your project here

sys.path.insert(0,cwd+'/venv/bin')
sys.path.insert(0,cwd+'/venv/lib/python3.9.16/site-packages')

os.environ['DJANGO_SETTINGS_MODULE'] = "electiondata_private.settings"
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

PS. I am using django 4.

Any help would be appreciated.

Upvotes: 1

Views: 121

Answers (0)

Related Questions