-
Hi! I refer to cookiecutter-django's documentation, under "Media files without cloud provider": "If you chose no cloud provider and Docker, the media files will be served by an nginx service, from a production_django_media volume. Make sure to keep this around to avoid losing any media files." Media files on my app are user generated and private. I want to store and serve them from the var/lib directory within Postgres after the user is authenticated. How do I not have the media files served by Nginx? I don't see an option to opt out in the documentation. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi @yaksheng, When you say you want to serve the media files from "var/lib" within Postgres, I would like to understand why you cannot serve them from Nginx and make them accessible only to the user and not to the outside world. That should be easy to do even with regular system level permissions. Here is a discussion around that from the Postgres Forum. |
Beta Was this translation helpful? Give feedback.
-
I have never actually used PostgreSQL as a file server, and from my current understanding, I think it was not designed for that and there are probably better alternatives. If you need to server private files from infrastructure that you maintain yourself (i.e. you are not using Amazon S3 and similar) and limit their access to authenticated users and apply any rules you want, you can use django-downloadview + Nginx X-Accel https://www.nginx.com/resources/wiki/start/topics/examples/x-accel/ |
Beta Was this translation helpful? Give feedback.
I have never actually used PostgreSQL as a file server, and from my current understanding, I think it was not designed for that and there are probably better alternatives.
If you need to server private files from infrastructure that you maintain yourself (i.e. you are not using Amazon S3 and similar) and limit their access to authenticated users and apply any rules you want, you can use django-downloadview + Nginx X-Accel https://www.nginx.com/resources/wiki/start/topics/examples/x-accel/
https://github.com/jazzband/django-downloadview