MULTITENANT_RELATIVE_MEDIA_ROOT not working properly
See original GitHub issueWhen i upload file, it’s working fine but, when i try to preview the file after clicking the link i’m getting 404 error. Here is my configurations
STATICFILES_STORAGE = "django_tenants.staticfiles.storage.TenantStaticFilesStorage"
MULTITENANT_RELATIVE_STATIC_ROOT = "" # (default: create sub-directory for each tenant)
DEFAULT_FILE_STORAGE = "django_tenants.files.storage.TenantFileSystemStorage"
MULTITENANT_RELATIVE_MEDIA_ROOT = "" # (default: create sub-directory for each tenant)
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I got the same problem. when you add "MULTITENANT_RELATIVE_MEDIA_ROOT = “” all files will be saved in “media/schema_name/file”, but the reference in the database is still “media/file”.
adding “%s” in MULTITENANT_RELATIVE_MEDIA_ROOT will fix it (for me)
Solution: "MULTITENANT_RELATIVE_MEDIA_ROOT = “%s”
I had the same problem. And i solved by doing MULTITENANT_RELATIVE_MEDIA_ROOT = “%s” and in both main urls.py i.e for public and tenant main urls.py i added : if settings.DEBUG: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) And suddenly it worked for me.