Docker-compose django nginx doesnt find static files - django

I'm trying to dockerize my application and i'm almost done. The only issue I have is that nginx doesn't find my static files. I've searched all over the web, but I havent found a solution yet.
I made a volume that's shared between the Django application and the Nginx server, and in my settings.py I pointed the settings to that, but no luck.
I'm not sure how many of the files you need to inspect, so I uploaded the whole project to Github.
https://github.com/temp3020102/django_project
When the image has been built and you navigate to http://localhost/admin one can see that the CSS is missing.
I'm aware that posting the secret_key and such to the internet is not a good idea, and i'm of course changing that once I have a fix for the issue. It's just there for the sake of your convenience.

You are referring to /home/app/web/staticfiles/ for static files in nginx
But in code it is located in /home/app/web/static folder

rename the folder static to static_volume

Related

Folders statics not found in server google - Django

Django cannot find the static files on the google server, the
python manage.py collectstatic
command has already been used with the settings.py configured.
To solve this problem I followed several tutorials that showed us how to deploy static files, including the documentation itself. However, none got results. It is worth mentioning that this same code and configuration worked in the homolog version of the system.

azure static files missing/ wrong MIME

Django website deployed to Azure (F1 - free subscription) Linux, all static files are missing/ not rendered. Even the files from admin which are not changed. Locally works fine, I've googled around tried to upload without VS code etc. still does not work.
Source code of app - https://github.com/Azure-Samples/python-docs-hello-django
Tutorial - https://learn.microsoft.com/en-us/azure/app-service/quickstart-python?tabs=bash&pivots=python-framework-django
Deployed via Azure CLI, any pointers I would gladly take.
P.S. Templates dir and HTML files are fine/ loaded correctly, images from static are also missing.
Solution to my problem was new install + whitenoise, requirements.txt for Azure, following the approach and settings file in the video below:
https://www.youtube.com/watch?v=D6Wyk9q2JM0&list=RDCMUCsMica-v34Irf9KVTh6xx-g&start_radio=1&t=302s
Github project - https://github.com/microsoft/beginners-django

Django sphinx docs made by cookicutter folder confusion

I'm a bit confused by the folder structure the sphinx makes for its documentation when starting a fresh new Django project with cookiecutter.
I have my project set up in docker, as per instructions, everything is serving fine and I have the following folder structure for the documentation.
When I run the command make html in the docs container (or by using the docker-compose local.yml file) I get the following structure.
A new folder "html" is created and it's containing everything from the surrounding folders. Is this correct? Am I understanding the process correctly?
For me, it looks like some bad settings for some source folder somewhere.
I'm an experienced python dev, familiar with Docker as well, but I'm pretty new to Django and sphinx.
Can somebody please guide me to the right path, possibly share their Django sphinx docs workflow?
Thank you very much.

Django stopped finding application static files

I have a Django 1.9.8 app that's working most of the times. For some reason, Django stopped service application static files, including those of the build-in admin application.
Running collectstatic only looks for files in my STATICFILES_DIR, as does findstatic.
I do have django.contrib.staticfiles in my INSTALLED_APPS, and yet - Django does not look for its apps' static files.
I'm stumped and don't even know where to look next.
Turns out the problem was fixed by deleting the virtual environment and creating it again (without upgrading anything).
Hope this saves someone some time in the future.

Symlink to static html page Django

Does anyone know how to symlink using django? I have added sphinx documentation to my django project but as it is not a django package itself so i cannot link it us using the usual django framework. My Boss told me to copy/symlink it into the static folder in a help directory then it will be available through /static/help/ but i have no idea how to do that and online information is sketchy at best.
Symlinking is a file system feature that allows you to create shortcuts from one path to another. It doesn't have anything specifically to do with django.
Because your webserver is serving the contents of your STATIC_ROOT folder, you can just symlink sphinx build folder to a path in your static folder and your webserver will serve it.
Do do so (assuming you are on ubuntu or similar):
ln -s /path/to/existing/sphink/build/ /path/to/django/static/folder/help/