Repository navigation
Replies: 3 comments 6 replies
|
Since, Kamal doesn't support path-based virtual hosting, consider hosting it on different subdomain such as |
|
I've had the same struggle and have "solved" it (OK, a little hacky, but it's working) with an nginx accessory in my
|
|
I managed to use an nginx accessory to serve static files for Django, by having it listen on port 81 but exposed properly on kamal-proxy with https on a different subdomain. To make nginx listen on port 81, my custom.conf contains this: I guess I could just have done I also managed to serve user uploaded media files that will be "public" (open for everyone to see). I had a host directory act as a volume in both the django and nginx containers: Django container just syncs the Django settings would look like this: Mind you, this solution is only for using "public" media files, so no authentication/authorization involved. For such features you should probably use Django file storage, or implement custom and authorized views for specific file system access. Have to admit Kamal functions as advertised. It's for container deployment. There is a lack of examples in the documentation, but you could deploy any web server/framework combination if you set it up properly. |
Uh oh!
There was an error while loading. Please reload this page.
Django does not provide file serving out of the box. It's easy to solve this for static files (using whitenoise), but that leaves us lacking for serving media files. In the past, I used a nginx container alongside django, to serve those files.
Issue is: I'm not sure how to replicate the same behavior with kamal.
I was thinking of using nginx as an acessory, but how do I then route all requests to
{{host}}/mediato nginx and not django? Or better yet, is this the way to go? (I'm not looking into using S3-like services, would prefer to keep media files on the server)All reactions