Emad Mokhtar
Emad Mokhtar

Reputation: 3297

Serve uploaded files from NGINX server instead of gunicorn/Django

I have separate servers one running NGINX and other running gunicorn/Django, I managed to serve static files from NGINX directly as recommended from Django documentation, but I have an issue with files uploaded by users, which will be upload to server has gunicorn, not the server has NGINX, thus users can't find their files and browse them.

How to upload files from Django to another server? or How to transfer files from other server after uploading to NGINX?

Note: I don't have the CDN option, I'll server my statics from my servers.

Upvotes: 1

Views: 208

Answers (1)

Antonis Christofides
Antonis Christofides

Reputation: 6939

You need to implement a solution for sharing files from one server to another. NFS is the standard in Unixes like Linux. An alternative is to use live mirroring, i.e. create a copy of the media files directory in the nginx server and keep it synchronized. There are probably many options for setting this up; I've successfully used lsyncd.

Upvotes: 1

Related Questions