6
13 Comments

Who is using Python on the back end? What framework?

Using Python? What framework are you using? What about database and other supporting tech? How and where are you deploying?

There seem to be a lot of Node and PHP users on here and I am wondering if Python people are out there, and what are you using to ship those MVPs fast.

posted to Icon for group Developers
Developers
on February 8, 2020
  1. 6

    Frameworks - Building your Python application.

    • Django: Extremely fully featured, has long been the go-to framework for many.
    • Flask: Lightweight, doesn't include all the bells and whistles as Django but extremely simple to get going.

    Web Servers - Sits in front of your Python application to handle HTTP traffic.

    • Gunicorn, Uvicorn, and many many more. I've generally stuck with Gunicorn but haven't looked into this recently.

    Storage - For persistent or ephemeral storage of data.

    • Relational (if your data has any sort of relationality, choose this): Postgres / MySQL, choose whichever you're more comfortable with. I generally lean Postgres.
    • NoSQL (if you just want simple blob storage without much complexity in relationships, choose this): Mongo, Couchbase, etc. Mongo is the default choice generally.
    • Caching (generally used along with one of the above to increase performance): Redis, Memcache, etc. Redis has served me well for years.

    Note: Many managed options for each of these such as GCloud Datastore (NoSQL), GCloud SQL (Relational), AWS RDS (Relational), AWS Dynamo (NoSQL), Heroku Postgres, Heroku Redis, etc.

    Deployment - Running your application on a server.

    • Paas (Platform as a Service): GCloud App Engine, AWS Beanstalk, Heroku, Render. The simplest way to deploy your code. Generally just need to provide a build command and some auto-scaling settings and you are good to go. Also play really well with their managed storage options. One drawback, extremely opinionated so you don't have much configurability but this is generally worth the trade off early.
    • IaaS (Ifrastructure as a Service): AWS EC2 (individual VMs), AWS EKS (Kubernetes cluster), GCloud GCE (individual VMs), GCloud GKE (Kubernetes cluster). Much more flexible but require you to manage your own VMs or Kubernetes clusters.
    • Bare metal: much like IaaS but your get dedicated hardware.

    I've preferred the following stack, at least early on:

    • Flask
    • GUnicorn
    • Postgres (GCloud SQL)
    • Redis (GCloud Memorystore)
    • PaaS (Google App Engine or Heroku)
    1. 1

      Have you tried fastapi?

      1. 1

        I haven't gotten a chance to use it yet, though I've heard good things. Any thoughts? Python hasn't been my primary ecosystem for a few years now so I'm not up to date on the latest and greatest.

        1. 1

          It was really good, preferred it over Flask.

          So for big projects i will use Django and for simple apis etc i will use fastapi.

          1. 1

            Nice, I'll check it out!

  2. 2

    Flask and Postgres with SQLAlchemy. For deployment I chose Hetzner server and use Gunicorn and Nginx.

  3. 1

    Hi Chris, back in the day I was deciding between Django and Rails. Actually I liked many things about Django (like the admin, auto migrations), but settled on Rails, because Ruby clicked a little better for me. As for deployment, I actually just use a Bash script to create a"git push" deployment (ala Heroku) on a Digital Ocean droplet. Why? I only use one VM per project and it gives me a lot of flexibility without headaches of keeping up-to-date with new versions of configuration management tools. If you are interested, I am actually writing about it in https://deploymentfromscratch.com/. Both Ruby and Python are used as examples.

  4. 1

    Flask & SQLAlchemy.
    Deployed to AWS Elastic Beanstalk.

  5. 1

    For me my new stack is going to be FastAPI + SQLAlchemy. I love SQLAlchemy which I use a lot at work currently and I am now playing with FastAPI and it looks good so far.

  6. 1

    Not using Python at the moment, but if I were I’d use Flask and SQLAlchemy. That’s honestly just because I have experience with those libraries; if you’re more familiar with Django or something you should use that.

    For the rest of the stack, I’d keep it as generic as possible. Use nginx if you need a web server, HAProxy for load balancing, etc.

  7. 1

    Yes - last 3 professional projects have been in Django / DRF on the back-end. Have worked with Java and Erlang before that. Very happy now with Django and likely to stick with it.

    Have used Angular2+ for the front-end which was not such a happy experience. Latest project has been Django / JQuery just to get something out quickly.

    Rest of my stack is Postgres / Docker (running Gunicorn) / AWS. Has been a steep learning curve but am productive with this now, so likely to stick.

  8. 1
    • For a full app, I still use Django
    • For API only backend I use https://github.com/zalando/connexion which is a flask based OpenAPI framework
    • Django ORM is great, but nowadays, I use less and less any ORM but go directly to the Postgresql, so I use Psycopg2 directly. I'm testing https://github.com/magicstack/asyncpg and https://github.com/edgedb
    • For hosting, I prefer the Google Cloud Platform, but this is not a strong preference. I use Terraform to manage infra on whatever platform I have to deploy.
  9. 1

    This comment was deleted 5 years ago.

Trending on Indie Hackers
The most underrated distribution channel in SaaS is hiding in your browser toolbar User Avatar 192 comments How are you handling memory and context across AI tools? User Avatar 107 comments I gave 7 AI agents $100 each to build a startup. Here's what happened on Day 1. User Avatar 101 comments Do you actually own what you build? User Avatar 62 comments Code is Cheap, but Scaling AI MVPs is Hard. Let’s Fix Yours. User Avatar 34 comments How to see your entire business on one page User Avatar 29 comments