Can you containerize different django applications belonging to a single project in different docker containers?

Viewed 204

So basically, I have three different modules or apps in a single django project - These are registration application (registers the user), login application (login), status application (retrieves the data and displays the currently online users). I use redirects to redirect from one template to another such that the registration page will redirect to the login html page and so on. I have kept all the html files in a template folder. I have a common project for all these applications. I want to containerize each of these applications in to a single container, such that I would have three different containers but I am having troubles in understanding how the redirects would work? As these applications are interacting with each other, how would I be doing this? I would implement the databae on AWS or GCloud.

1 Answers

I think you can do it, I hope I can help. You can do this with docker-compose in the following way. Create 3 containers with the same image, same network and different names. Assign a separate port to each container for example use 8000, 8001 and 8002. Now use a webserver for redirect pages. run a Nginx container and placing different upstream for different pages. Nginx listen port 80 and then redirect each page to their container.

    upstream register_domain_com {
    server 1.2.3.4:8000;
}

    upstream login_domain_com {
    server 1.2.3.4:8001;
}

.
.
.
Related