Skip to content
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

Add setting to exclude directories from STATIC_ROOT #124

Closed
wants to merge 2 commits into from

Conversation

svleeuwen
Copy link

@svleeuwen svleeuwen commented Jun 8, 2018

This allows to exclude e.g. the /admin/ directory which is not required in the static site.

See also #107.

@palewire
Copy link
Owner

I wonder if there's way to handle this upstream of bakery. Could you remove it from our INSTALLED_APPS? Or change your staticfiles configuration elsewhere in your settings?

@palewire
Copy link
Owner

I am closing this PR pending a response to my question above.

@palewire palewire closed this Nov 27, 2018
@svleeuwen
Copy link
Author

I forgot about this PR. To answer your question:

Removing django.contrib.admin from INSTALLED_APPS does work. You could add the removal to a separate settings file and use python manage.py build --settings=config.settings.bakery. I don't think this is very user friendly though.

Also, when running a build, this will exclude the directory from the STATIC_ROOT (because build runs collectstatic), which can result in unwanted side effects. (this PR only excludes from the bakery build, after collectstatic has been run)

Finally, this doesn't work for e.g. wagtail.* apps. Removing those results in errors like:
RuntimeError: Model class wagtail.users.models.UserProfile doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS. when building.

@palewire palewire reopened this Nov 27, 2018
@palewire
Copy link
Owner

palewire commented Nov 27, 2018

Reopening for discussion. Is there a use case here beyond the admin app? I wonder if we might be better off tailoring a fix specifically for the admin, though I'm not fully swayed that this static file deployment of admin files is a very big deal.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.6%) to 80.415% when pulling 82a7046 on svleeuwen:master into 18bbb24 on datadesk:master.

@svleeuwen
Copy link
Author

svleeuwen commented Nov 27, 2018

Is there a use case here beyond the admin app?

I think using wagtail (or any other CMS that includes it's own static files) is a reasonable use case. Currently these folders are included in the bakery output:

wagtailadmin/
wagtaildocs/
wagtailembeds/
wagtailimages/
wagtailmedia/
wagtailmenus/
wagtailmodeladmin/
wagtailsettings/
wagtailsnippets/
wagtailusers/

So, in my project I'm using:

BAKERY_STATIC_EXCLUDE_DIRS = [
    'admin',
    'wagtail*',
]

More people are having this issue, hence this related issue in wagtail-bakery.

@palewire
Copy link
Owner

palewire commented Dec 5, 2018

Could we solve this further upstream with how we handle collectstatic's configuration, rather than having them be collected only to be clobbered?

@palewire palewire closed this Feb 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants