TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Host multiple flask and django apps on single server

5 pointsby gingerjoosalmost 13 years ago
What would be the best way to host multiple flask and django apps on a single server? From reading around it seems to better to use nginx and/or gunicorn, but I can't decide between nginx alone OR nginx + gunicorn. Should I consider Tornado? I don't really plan to have real-time stuff in my apps.<p>I'm using an EC2 micro instance (Ubuntu Precise)

2 comments

iamsidd2k7almost 13 years ago
In my experience using nginx + gunicorn will help here is why: gunicorn create child processes for your server. This way you can have 3-4 process all working towards serving your web-application. Nginx helps for serving static files and reverse poxing to either flask / django process. You should also consider using something like supervisord. Supervisord will make sure you're processes are restarted if they crash for some reason.
评论 #4161076 未加载
bmeltonalmost 13 years ago
I have more experience with Nginx + Gunicorn, but I can tell you that it's pretty painless. "manage.py run_gunicorn" to get started, and you can assign it an arbitrary port and number of worker nodes depending on how many users you expect. Supervisor will obviously be needed to keep it up and running, but I've got dev instances that are fairly heavily trafficked I'm not running supervisor with, and I've yet to see Gunicorn crash, where I used to see Flup crash constantly.<p>In addition to what's already been mentioned, you'll definitely want to be using virtualenv for portability. Being able to maintain different libraries for different apps is essential, and virtualenv does a great job of keeping things isolated.
评论 #4185328 未加载