Serve Static Files by Nginx from Django using Docker

This is more of a follow up post of my previous blog. Before I start, I am assuming you have successfully deployed django using docker & nginx, but having some problems serving static files. No worries, its easy. Just follow these steps: 1. In your django file, add static file directory i.e. STATIC_ROOT=/static. So what it will do is, when you run collectstatic command(python collectstatic), it will store the static files in your /static directory of OS. 2. Now in docker-compose.yml…

Keep reading

Categories: Django, Docker, Nginx, technical-blogs

Deploy Django, Gunicorn, NGINX, Postgresql using Docker

This post mainly based on this blog: I will be extending this post by serving django+gunicorn using Nginx, also I will using Postgresql docker container to use it as database. Lets not waste time and go to the following steps. 1. Let's make an empty directory named myproject and add another folder inside name it src. src should contain the django project. For testing purpose lets put a simple django project inside named mydjango. 2. Let's create a subdirectory inside myproject and name…

Keep reading

Categories: Django, Gunicorn, Nginx, Postgres, Docker, technical-blogs