Django Docker media files save and restore - django

Hi there I am trying to deploy a project in docker with django and django rest framework. According to the documentation I successfully able to deploy it and it is working fine with media files. I am able to upload media files (images) and it also shows the right file at the right side. But the problem is for some changes I need to re-build the container with new code ... after re-deploying It can not able to found out the previously uploaded media files(images). I badly need help on it.enter image description here
this is my docker-compose file.
enter image description here
and dockerfile

Related

How can I Deploy a Django App as a .war file or in any other packaged way?

I have a Django Project for which I am trying to find a way to deploy as a .war file.
My objective is
to not reveal the source code during deployment
to De-Couple Django App from Database and deploy as a .war file. This will help me to update the app without re-initializing database.
As Jython is not supported for Python3, is there an alternative?
I also tried to create an exe through PyIntsaller but it acts as a malicious executable.

AWS Amplify - How to Export and Download Video Files like in XAMPP/Apache

I have a web app that lets me export videos in a MP4 video format. I can set this up locally using XAMPP Control Panel and open it as Administrator and install Apache. Finally, going to the htdocs folder and place the local files from there. How can I set this up from my GitHub repo on AWS Amplify? Or is it easier to use Heroku

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

I want to configure AWS S3 on my django project but many of my client's media files are on my pythonanywhere server already

I want to integrate AWS S3 in my django project and i have successfully integrated that but the problem is many of my client's media files are already on the pythonanywhere server and now i want to change it to AWS S3 so the upcoming media files should be stored in S3. But now what happens is that the new files are storing correctly and i can open them but the previous files, when i open them because of the media files url i suppose django looks it in AWS S3 but they are not there. So i need django to understand to look for the media files where they are stored like for the previous files i want django to look in the server directory and for new files in S3 instance.
Hope that makes sense.
This is my AWS S3 configurations file for my django project
This is my django settings file, mainly focuses on media files
So if you want to move your static files that were uploaded before you configured AWS S3 with django you can run this command in your command line: python manage.py collectstatic.

How to edit docker file of the image which is pulled from registry?

I have pulled one image from registry.
I am able to see image using following command :
$docker images
But I am not able to edit its Dockerfile.
You can grab the dockerFile from hub.docker.com -> search the image you want,
Download it make your modification and build it, or run the image downloaded and make your modification, commit it and push it on your docker hub account.
Hope this will help you.