Skip to content

Working with static files (Beast Whoosh front end)

Frederic Font edited this page Mar 23, 2023 · 7 revisions

To work with static files (Beast Whoosh front end only) you need to use node to build the css/js/... files, and run Django's collectstatic to copy the generated static files to the correct directory. This can be done inside the Freesound web container. Here are the steps you need to follow:

  1. Build Freesound Docker image(s) (you probably have done that already)

docker-compose build web

  1. Install node dependencies (this will create a node_modules folder in your repository directory)

docker-compose run --rm web npm install

  1. Build static files and run collect static

docker-compose run --rm web npm run build && docker-compose run --rm web python manage.py collectstatic --clear --noinput

Every time you change something of the static files (javascript or css), you'll have to rerun step 3). This is not very optimal but ¯\(ツ)

NOTE 1: FYI, BW frontend uses a static files storage which will automatically add hashes to static files filenames and change paths accordingly in templates.

NOTE 2: To load Freesound with BW frontend activated, you need to set a request parameter as follows: http..../?fend=bw. To go back to the previous frontend, use http..../?fend=ng.