-
Notifications
You must be signed in to change notification settings - Fork 348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem running collectstatic_schemas: Files from MULTITENANT_STATICFILES_DIRS are not collected. #299
Comments
I think you still need to provide a value for # https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS
STATICFILES_DIRS = [str(APPS_DIR / "static")] There is also a pending PR at #266 that addresses a few known issues - perhaps try checking out that branch and let us know if that, and the config changes suggested above, resolves your issue? |
I added this to STATICFILES_DIRS but it didn't solve the problem:
The static files in this dir are collected but still the files in MULTITENANT_STATICFILES_DIRS are ignored. |
Thanks @jcass77! I check out jcass77:fix/staticfiles (https://github.com/tomturner/django-tenants/tree/89bcc6b4c64eaf31a3bbafa40116265affd5b9b5) and this did the trick for me. Now static files from tenants are collected. Also if no
is specified in settings.py. Anything else I should / could do to help? Am quite new to the whole error reporting / fixing thing ;-) |
@loctimize, I received a few GitHub email notifications containing comments about issues that you were experiencing, but can't find them linked to this issue anymore?
At any rate, while looking over #266 again I realised that a bunch of the tests cases in that PR weren't actually being run, which uncovered a handful of regressions that I since fixed via 4b03611. Could you perhaps check out a fresh copy of #266 and try again? |
@jcass77 : I checked out https://github.com/tomturner/django-tenants/tree/68938b6f04a4904ec7d593a8d3c986996b5a0f6c and ran the tests encountering 2 errors. Environment: MacOSX, Python 3.6.7, Django 2.2.1 and 2.2.4 Here is my test output:
Update: When running collectstatic_schemas for a tenant, files from the tenant-specific dirs defined in |
@jcass77 I am trying ;-) I do have a version of django_tenants based on https://github.com/tomturner/django-tenants/tree/89bcc6b4c64eaf31a3bbafa40116265affd5b9b5 that I fixed late at night some days ago. This one works as expected for collecting the static files and tests pass ok. I uploaded it here. I just changed files/storages.py and staticfiles/storage.py as far as I remember. Repo: https://github.com/loctimize/django_tenants/commits/master I am still learning the whole git workflow thing so sorry for not being more efficient here. |
Thanks for the feedback @loctimize.
What we are aiming for here is that any available files in MULTITENANT_STATICFILES_DIRS will override those in STATICFILES_DIRS. Extract from the docs:
...so we can then have the following scenarios:
This is a bug - I might have broken something when I tried to get all of this to work with django-sendfile2 so that files in |
I am using the fix and it's working great. It collects specific images and css from the tenants MULTITENANT_STATICFILES_DIRS. Thank you, for the fix |
Hi everybody,
When running
python manage.py collectstatic_schemas --schema=schema_name
, files in MULTITENANT_STATICFILES_DIRS are not collected. I am running django v.2.2.4 and django_tenants v.2.2.3 on Python 3.6.7.My relevant settings in settings.py are:
When print out the path variable in the listdir method in line 311 in /site-packages/django/core/files/storage.py that lists all dirs that are going to be collected, the first paths are:
Strange thing is that the first path lists the target static path for the tenant and not the files from MULTITENANT_STATICFILES_DIRS where I have 3 subdirectories named css, img, js.
Any idea what is happening here? Any additional information you need?
Many thanks!
The text was updated successfully, but these errors were encountered: