Hacker News new | ask | show | jobs
by wilson_4 2433 days ago
Can’t really go wrong with python + Django (or flask if you want to stay minimal). Sounds like you’ll need auth, so Django should support that out of the box.

Both will integrate easily with Postgres, and for flask, take a look at the peewee ORM.

3 comments

It won't be quite as fast to get off the ground as Django since it's not batteries included, but as an async Python fan I like to spin things up with aiohttp + Postgres like here: https://github.com/francojposa/aiohttp-postgres or here: https://github.com/francojposa/aiohttp-auth

The upside is that aiohttp's built in server can be put up in production with a lot more confidence than Django's built-in server, meaning one less layer to configure

fully agree. I wrote a pretty complex API within a couple of days in Django + Django Rest Framework. I did not know how to build web applications or APIs before. Great experience.
What’s the easiest/best way to host python+flask?
I recommend using Dokku to save money! It’s the open source version of Heroku. You can deploy by adding one 2 line config file to your repo, the you “git push dokku master” and it builds and deploys your website in a few seconds.

You can use a digital ocean or light sail instance to host Dokku for way cheaper than Heroku and you have more control of the machine. Downside is Dokku is made for one server, so you can only really scale to like 64 cores before you need something else.

Most apps will never need more than one server realistically, but you have to determine that for yourself!

I use it for a Flask app. FWIW, I believe digital ocean has tutorials and an image to use to get Dokku off the ground fast!

Easiest? Probably heroku after you get past the initial boilerplate - but can quickly become expensive.

Most cost efficient would be to Spin up a cheap droplet in digital ocean, install docker-compose with a Postgres service and python image. In the python image, just boot up a Django server on port 80. If you need https, youll need to add something in front of Django, like nginx to handle ssl termination.

App engine could also be a very quick and cheap way - you get ssl, and domain for free, but you do need to buy into their way of doing things, which has a bit of a learning curve .

I'd use Gunicorn instead of Django dev server.
Yes, definitely for production use. Getting started though the dev server is fine for testing.
Apache + mod_wsgi