We have a Django project that we are testing with DO Apps for deployments and possibly use in production.
We have some user-generated files like user profile pictures etc. Every time I deploy some new code or some changes. The pipeline automatically deletes the media files. Here is the code that I am using in my Django project settings file.
The code below creates mediafiles and staticfiles folder in my project directory. On the front end, it uploads and serves the file correctly but user profile pictures (media files) are gone after every deployment.
Any urgent help from the community and DO support will be highly appreciated. This is a big blocker for us for going into production.
P.S: Static files are working as expected.
STATIC_URL = "/static/" STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles") STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),) MEDIA_URL = "/media/" MEDIA_ROOT = os.path.join(BASE_DIR, "mediafiles") MEDIAFILES_DIRS = (os.path.join(BASE_DIR, "media"),)
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.