You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 23, 2019. It is now read-only.
Right now, python-webpack supports findstatic, which is used by Django to locate and serve static files during development. However, it doesn't support collectstatic, which is used by Django to gather all static files and move them into STATIC_ROOT for deployment. It seems that python-webpack bypasses collectstatic by outputting webpack_assets directly into the STATIC_ROOT directory, with the assumption that you will simply sync the STATIC_ROOT directory with your static server (e.g. S3). Unfortunately, many people use django-storages (example), which relies on the collectstatic step to sync static files with S3.
Fortunately, the only necessary change to support collectstatic is removing the list() override in WebpackFinder - the implementation in BaseStorageFinder works just fine. If we want collectstatic to work properly though, we shouldn't encourage people to output webpack_assets directly to STATIC_ROOT anymore, as this can cause issues like this. I'm proposing changing the name of this setting to OUTPUT_ROOT and recommending people set it to something like BASE_DIR+'generated_assets'. Of course, if people aren't interested in using collectstatic, they can still set OUTPUT_ROOT=STATIC_ROOT and get the same behavior.
The text was updated successfully, but these errors were encountered:
Right now, python-webpack supports
findstatic
, which is used by Django to locate and serve static files during development. However, it doesn't supportcollectstatic
, which is used by Django to gather all static files and move them intoSTATIC_ROOT
for deployment. It seems that python-webpack bypassescollectstatic
by outputtingwebpack_assets
directly into theSTATIC_ROOT
directory, with the assumption that you will simply sync theSTATIC_ROOT
directory with your static server (e.g. S3). Unfortunately, many people use django-storages (example), which relies on thecollectstatic
step to sync static files with S3.Fortunately, the only necessary change to support
collectstatic
is removing thelist()
override inWebpackFinder
- the implementation inBaseStorageFinder
works just fine. If we wantcollectstatic
to work properly though, we shouldn't encourage people to outputwebpack_assets
directly toSTATIC_ROOT
anymore, as this can cause issues like this. I'm proposing changing the name of this setting toOUTPUT_ROOT
and recommending people set it to something likeBASE_DIR+'generated_assets'
. Of course, if people aren't interested in usingcollectstatic
, they can still setOUTPUT_ROOT=STATIC_ROOT
and get the same behavior.The text was updated successfully, but these errors were encountered: