2 Django projects deployment on AWS (same EC2 instance)

Hi, I have a Django app running on AWS. I do not have a domain name (really do not need it because the application is only for internal use). I am having really hard time to deploy my second application on the same server.

So far I have created different files configuration for each one of my application (.service and .socket ) so each one should work fine without conflicts.

My problem is that I tried everything I could and read all I found about it and could not find a solution to the following question:

"Where and how to make configurations in order to have the same IP address running both apps? Like in order to access them lets say : for the first app and for the second app

Any help will be very appreciated

Isn’t the solution just running the applications on different ports?

Thanks for the reply.

Yes, it can be. I just do not know how to do it then… could you provide an example of the configuration?

You’ve got a couple different ways of doing this - it all depends upon how you’re deploying it.

For example, if you’re using nginx as your webserver, you would change the listen directives for each configuration to specify different ports. (Or, you can allow nginx to listen on standard ports and assign the different projects to “directories” within the url structure - that’s how we do it.)

Or if you’re using uwsgi directly, you can specify the ports in your ini file.

(I was going to mention doing it with gunicorn, but gunicorn recommends running gunicorn behind nginx.)

Note: I still recommend getting a domain name. if you’re paying for a static ip on EC2, you’re probably paying more for that than you would for a cheap domain. And if you’re not paying for a static ip, then you’re going to have issues to deal with when you get a different IP address.

1 Like

If your are not using other AWS service, I think is a better approach to use a cheap VPS (I use Hetzner) with a domain, It will be cheaper and more powerful. I have 5 small projects on a relative small VPS, and will downgrade the hardware because 99.99999% of the time it uses less that 10% of processor and less than 16% of ram. And as @KenWhitesell this could be cheaper than a private IP, plus you gain SSL (That I think r is a lot of more difficult with your approach)

1 Like


Thank you very much for your reply. I think that it makes more sense really do as you said. I wanted to try AWS in order to learn and see what they have to offer (which is way more then what I need) and I am using their free service.

Thank you also @KenWhitesell . At the end I (for the time being) just redirected to access to different ports. But like I mentioned, I will look somewhere else to host it.

Again, thank you for the time and effort put in helping me.