4 ms·
why would you want a full framework with a admin back end for a microservice?
by soperj 5y ago
why would you want a full framework with a admin back end for a microservice?
- bb88 5y agoIn fairness, you can disable the admin service if you want, then it just makes Django a big fat bloaty library. But more to the point, I feel like DRF is kind and of a weird solution anyway, like the request object is different from Django, it doesn't support schema generation without some third party libraries... Frankly, FastAPI with an orm sounds like the ultimate python microservice framework, anyway. Pgcli works as an admin interface in a pinch.
- holler 5y agoAgree. What advantage does FastAPI have over Starlette on it's own? I've written my latest api w/Starlette and found it to be excellent.
- esclerofilo 5y agoVery comfortable pydantic integration. This gives you Swagger docs and type checking for free. I've never actually used starlette directly, but it doesn't sound very ergonomic
- Nextgrid 5y agoThe batteries included with it. A consistent DB interface, ORM and migration system (independent of the underlying DB), same for cache (similarly you can swap Redis for Memcache and your code doesn't have to change), same for e-mails (swapping e-mail providers is a matter of writing a new backend, application code doesn't change), etc. Sure, you could do all this with Flask and SQLAlchemy, but Flask and these minimalist frameworks always feel like they lack structure and good conventions which means every project does its own thing. In Flask & SQLAlchemy I still don't have a good way of organizing my application and model classes considering they have to inherit from an instantiated DB connection object. I'm sure there's a way and I haven't researched enough, but why bother when Django solves this problem with "one true way" that everyone conforms to? Also keep in mind that despite Django having many features, only those that you actually use will be invoked; you can slim it down further by removing some middleware (hooks that run upon every HTTP request lifecycle) but even in its default configuration it's pretty light - for example the admin is not loaded nor evaluated unless you actually assign it to a URL route and a request hits it. Same for the HTML templating support - unless you actually render a template from a view it's as if it didn't exist - you only waste some disk space but there's no runtime performance hit.