You bring your web app in a
- GitHub repo
- App Platform handles deployments and builds
- DNS, HTTPS, CDN, DDoS Mitigation, Vertical Scaling, Horizontal Scaling, and more.
Media files are deleting after every deployment to DO Apps + Django
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"),)
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.×