AttributeError: 'WSGIRequest' object has no attribute 'tenant'
See original GitHub issueI get this error when I use subfolder middleware
Traceback (most recent call last): File "/home/vypa/projects/together_app_backend/together_backend/env/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/home/vypa/projects/together_app_backend/together_backend/env/lib/python3.8/site-packages/django/utils/deprecation.py", line 116, in __call__ response = self.process_request(request) File "/home/vypa/projects/together_app_backend/together_backend/env/lib/python3.8/site-packages/django_tenants/middleware/subfolder.py", line 55, in process_request self.setup_url_routing(request) File "/home/vypa/projects/together_app_backend/together_backend/env/lib/python3.8/site-packages/django_tenants/middleware/main.py", line 79, in setup_url_routing (force_public or request.tenant.schema_name == get_public_schema_name())): AttributeError: 'WSGIRequest' object has no attribute 'tenant'
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:10 (1 by maintainers)
Hi @gerald9784
Seems this is a bug in subroute feature. I have fixed that by extending the TenantSubfolderMiddleware and overrided the “setup_url_routing” function. something like this:
and finally in your setting replace the django_tenant middleware with this new CustomTenantSubfolderMiddleware class: OLD:
NEW:
I hope this help you!
Was this issue fixed by #642? If not, could this issue be related to the version of gunicorn?