-
Notifications
You must be signed in to change notification settings - Fork 97
Working with static files (Beast Whoosh front end)
To work with static files (Beast Whoosh front end only) you need to use node to build the css/js/... files, but a number of environment variables must be passed including some Django settings. For that reason we added a custom Django management command that will set the needed env variables and call npm. Also BW frontend uses Django's collectstatic so you need to run that as well in order to copy the generated static files to the correct directory. So far there is no way to automatize this process and it needs to happen manually running the following commands (from the repository root):
- Build Freesound Docker image(s) (you probably have done that already)
docker-compose build
- Install node dependencies (this will create a
node_modulesfolder in your repository directory)
docker-compose run --rm web npm install
- Build static files and run collect static
docker-compose run --rm web python manage.py build_and_collect_static
NOTE: You can also build the static files without the need of building Freesound Docker image(s) if you have node and npm installed in your system. Be careful however if you build static files both with and without Docker because the node_modules directory will be shared between the two and this might lead to some problems.
NOTE 2: BW frontend uses a static files storage which will automatically add hashes to static files filenames and change paths accordingly in templates.
NOTE 3: To load Freesound with BW forntend activated, you need to set a request parameter as follows: http..../?fend=bw. To go back to the previous frontend, use http..../?fend=ng.