Pierre-Sassoulas / django-survey

A django survey app that can export results as CSV or PDF using your native language.
GNU Affero General Public License v3.0
217 stars 145 forks source link

Styling not found #118

Closed gjelsas closed 3 years ago

gjelsas commented 3 years ago

I'm currently running the survey in a docker container behind a letsencrypt nginx proxy. Ssl works and the text is displayed. Whats missing is the styling of the website: spacing, the admin-panel, I guess all things css related... Any clues on that? Am I missing some setting? I think this error is to blame: "GET /static/survey/js/jquery.min.js HTTP/2.0" 404 2470 " Thanks for the work!

Pierre-Sassoulas commented 3 years ago

It definitely sound like something to do with static files not accessible. Maybe not deployed properly with the command to collect them, or something to do with the server configuration not being able to access the directory. I was using apache myself, but nginx probably need some configuration too ?

By the way I never used this project inside a docker, if you can contribute the generic part of the one you did for #62 that would be much appreciated ! :)

gjelsas commented 3 years ago

So, my mistake was not giving proper instructions to the nginx reverse proxy docker container. I fixed that by adding


 location /static/ {
         alias /static/;
     }

to the corresponding vhost-config file and mounting a folder containing the static files to /static in that nginx proxy container.

Just a misconception on my behalf. Maybe it helps someone...

gjelsas commented 3 years ago

for the admin-css stuff I had to copy /usr/local/lib/python3.7/dist-packages/django/contrib/admin/static/ to that static folder mentioned above for the admin site...

Pierre-Sassoulas commented 3 years ago

I owuld have thougth collectstatic would do that for you ? (https://docs.djangoproject.com/en/3.1/ref/contrib/staticfiles/#collectstatic)

gjelsas commented 3 years ago

No it didn't. Actually I extracted it from the container and copied it to the folder which gets mounted to the nginx-proxy container. I know, not a very clean approach, but does the job...