I need to build a large scale business application that will serve multiple clients with separate data isolation. The frontend will use htmx for dynamic interactions.
Which Python web framework would work best for this setup? I’ve been considering these options:
- Django
- Flask
- FastAPI
- Sanic
The app needs to handle different tenant databases and user authentication. Performance is important since we expect high traffic. Has anyone worked with htmx and these frameworks before? What are the pros and cons of each for this type of project?
hmm, what kind of scale are we talking about here? like thousands of tenants or just dozens? also curious - have you considerd the multi-tenancy approach yet? shared schema vs separate databases makes a huge differnce in framework choice imo. what’s your team’s experience level with these frameworks?
django’s probably your safest bet for enterprise stuff tbh. built-in admin, orm handles multi-tenancy pretty well, and htmx works great with django views. fastapi is nice but you’ll end up building alot of the enterprise features yourself. used both with htmx and django just feels more mature for business apps
FastAPI deserves serious consideration for your enterprise setup. I recently migrated a multi-tenant application from Flask to FastAPI and the performance gains were substantial, especially under high concurrent loads. The automatic API documentation generation has been invaluable for team coordination, and the dependency injection system handles authentication middleware elegantly. For tenant isolation, FastAPI works seamlessly with SQLAlchemy’s session-per-tenant pattern. The async capabilities become crucial when dealing with multiple database connections simultaneously. While you will need to implement some enterprise features from scratch compared to Django, the development speed and runtime performance often justify the initial investment. HTMX integration is straightforward through Jinja2 templates or direct HTML responses.