Serving static files outside Docker
Steps to reproduce
- Install Funkwhale on Debian following the documentation (I assume it also happens with the automated script, though I haven't checked).
- Do not modify the default Nginx configuration
- For example, go to the Django admin panel
What happens?
The CSS for the admin panel is not loaded. In general, all static files are not served.
The URLs for the files are /staticfiles/...
.
During installation, static files are installed and collected into a separate data/static
(STATIC_ROOT
) directory, which is disjoint from the front-end distribution. In the nginx configuration, there is no special case to route /staticfiles/
to STATIC_ROOT
(though I think there used to be), so nginx tries to find staticfiles
in front/dist
, which fails.
In Docker, this works because STATIC_ROOT
is mounted directly as staticfiles
inside the front-end root.
What is expected?
The files are properly served, either through a modification of the default Nginx configuration, the default Funkwhale configuration or adding a step in the installation documentation.
As a quick hack, I fixed it by "simulating" the Docker situation and creating a symbolic link staticfiles
in front/dist
to STATIC_ROOT
. However this isn't ideal since it will have to be re-created each time I upgrade the front-end.
Context
Funkwhale version(s) affected: 1.3.4
Instance configuration: Nginx, non-docker