Need advice about which tool to choose?Ask the StackShare community!
Not sure if we should use DRF or FastAPI. I hear many good things about FastAPI, but it doesn't seem to have a big community. Most important things for us: - speed - ease of development - scalability & security
We're likely going to use MongoDB, so not sure if that changes anything. Would appreciate any help!
I have worked with both frameworks, for your use case I would recommend using FastAPI. DRF, is no doubt an amazing framework and makes various things easy, but Django's MongoDB support is not that good currently, and since its a big framework, there are various things DRF and Django automatically do when you are using their predefined backend engines, which is not in the case of the MonoDB a NoSQL db. FastAPI will give you the flexibility and speed, for the community front, its also growing quite well there.
FastAPI might not have a big community but the documentation is awesome and covers every aspect of the framework itself. I'd recommend coming up with a pilot project yourself and try it on your own. It has a bit learning curve as FastAPI itself is a combo of a few existing projects otherwise it is amazing.
Depends on if you're building an api/microservice or a monolith. Django has a bigger ecosystem of plugins which may, or may not, save you from writng code yourself. DJango can "kind of" work with mongo, but it's really designed to go along with an SQL database. It's also an aging ecosytem though, with many unmaintained plugins.
FastAPI will win out in pretty much every other respect.
I've used both in production.
Simply put: if there's a relational database or it's more than just a handful of endpoints, Django REST Framework is the way to go.
FastAPI is like Flask in that it shines where you want it to do very little for you. If you want it to do a lot for "free", the Django-verse is and will continue to be better.
Last of all, I'll add that we refactored away from FastAPI to just use Starlette under the hood, because FastAPI pretty much assumes you want a REST API, and when don't want a REST API, you begin fighting with it.
Hey! So I am planning to make an e-commerce website with React Native as my frontend technology stack and MongoDB as my database. I was wondering what will be the best REST framework to use for my backend that will simply serve the frontend. Is Django rest framework a good option or should I go with Flask? I am currently leaning towards flask as the development team is well versed in it. Please help!
If the application is simple such as less endpoint or simple logic, I'd suggest Flask. But what you're building is quite a large system that contains many logics and a lot of models. So I'd suggest you with Django and Django REST framework. Django ORM is also one of the best ORM in the world as well.
FastAPI is modern microframework. If you haven't used any of them, I'd suggest FastAPI. Django REST is also good if you have previous experience with it.
I'm going to do an independent study with React for school, and I'm looking to build a full-stack application. I have lots of experience with react, but everything else I'd need is somewhat foreign to me. What I'm looking for is to provide a back-end for a React application.
I'm trying to find a back-end framework that can provide and integrate with almost everything I need (database, API, authentication). I will also need to be able to host everything eventually online rather than just locally on my computer. I don't want to use something that is just click-and-go: I want to learn a lot but find something that has much built in functionality, so I don't have to completely re-invent the wheel.
Does anyone else have experience with a stack you'd recommend that is a happy medium of helpful features while still requiring you to understand and implement the functionality yourself? Something well documented (e.g., it's easy to find documentation regarding putting all the pieces together) would be great.
Thanks in advance!
Greate documentation, lot's of info on StackOverflow and it's easy to learn, a lot of things it's already implemented on the stack. It's based on Ruby which is stable and constantly evolving.
Ruby/Rails have a lot of gems(libraries) that will allow you to connect to many DB systems, implement JWT or use a library for authentication.
I have a lot of API's created in Rails that respond to website and mobile apps, and you can create your first one without a lot of stress, responding with JSON easily.
You can use VSCode has good support for ruby and you will have all syntax help etc, I use Atom but I don't have the syntax support, didn't found a good package for that.
The most popular stack that comes to mind for your case if MERN ( Mongo, Express, React and Node) I would use Nodejs + Express for backend. Easy to build dynamic and powerful REST APIs. For DB, it would be Mongo DB and front end can be React + Redux (for global state management). Plus NPM has a ton of packages for most cases. PS : Webstorm (free for students) or VS Code ( free for all) for IDE
I would take either Rails or Node for your problem.
Rails is a great framework: super complete in regards of testing frameworks, authentication libraries, great community support.... but I would say that the latest versions are a bit of a mess for newcomers, because of the way they manage assets: if the assets are served by the framework(Assets Pipeline) vs using Webpack .
If you are already familiar with React, Node is another great framework that will require a bit more effort on selecting the dependencies but for your use case seems a great candidate.
In regards of what you are commenting about learning during the process, both can be Dockerized pretty easy and you can spend some time digging on the lifecycle of putting it into production. Rails has a ridiculous easy way of deploying with Heroku avoiding any kind of work, but if you want to get your hands dirty you can deploy either of the frameworks on a Dockerized environment to any cloud provider you like. That part is really interesting too, and if you are interested on the Devops side, I would say that Node is a bit easier and more convenient(smaller image sizes and times to build) than Rails. All in all:
Rails pros: stable framework, great community support, great testing utilities. Rails cons: How they manage the assets lately(Assets Pipeline vs Webpack), dockerize the app.
Node pros: You are already familiar with Js, simple, easy to put in prod allowing to spend time in the Devops side. Node cons: Dependency management in Js environments is a pain in the ass
Rails is an easy framework to pick up, and you'll get to love all of the magic it does for you. Some of that can be a little confusing at first but once you've got acquainted, this is part of the productivity Rails offers as opposed to other languages or frameworks that sometimes tend to require developers to waste a ton of valuable time setting up their own boilerplate when starting to work on a new project. More pragmatically, Rails is still extremely popular at both startups and at large companies, you can use it to power web applications, or backend APIs, and this will be extremely valuable on your resume. There also is a very large/rich set of libraries (called gems) that will allow you to focus on your actual project/product, rather than rebuilding what already exists. I'd recommend you go with the latest versions of Ruby (3.0) and Rails (6.1.1) so you are from the get-go learning them in their most current form.
Node.js is great if you already know Javascript. If not, JS is pretty easy to learn. There are many resources and tutorials online for JS and Node. ASP.NET (Core) is a good option if you know C# or need high performance. Node.js isn't a complete framework like .NET, so you need to add Express or another HTTP server, and Database connectors etc.
Although not entirely confident, as I've never used Django and I've not used ASP.NET since 2.0, but given your requirements, at first thought, I'd go with Rails.
Yet, may I ask if have you considered some BAAS such as Firebase, Hasura and the like? Although I've admittedly suffered a bit with Firebase - I'm not totally sure if I've used it correctly, tho. But I've heard really awesome things about Hasura. This slant compairson shows some Firebase's alternatives that I've never heard. In your position, I would have a look.
Cheers.
I recomand to take a look at this https://dev.to/andrewbaisden/creating-mern-stack-applications-2020-4a44
My journey to developing REST APIs started with Flask Restful, and I've found it to be enough for the needs of my project back then. Now that I've started investing more time on personal projects, I've yet to decide if I should move to use Django for writing REST APIs. I often see job posts looking for Python+Django developers, but it's usually for full-stack developers. I'm primarily interested in Data Engineering, so most of my web projects are back end.
Should I continue with what I know (Flask) or move on to Django?
If you want to be a Web developer with knowledge in another frontend and NoSql technology, maybe continue with Flask. However, if you want to create very fast solutions to grow up with a new business and merge these with data analysis and other tools, Django is the answer. Basically read more about the service architecture where you feel more comfortable, Microservice or Monolithic, but please will not married with any because they solve issues to different contexts.
Which is the best Python framework for microservices?
We are using Nameko for building microservices in Python. The things we really like are dependency injection and the ease with which one can expose endpoints via RPC over RabbitMQ. We are planning to try a tool that helps us write polyglot microservices and nameko is not super compatible with it. Also, we are a bit worried about the not so good community support from nameko and looking for a python alternate to write microservices.
Bottle is much less bloated and fast. Its built-in templating system is one of the fastest as it compiles the templates in bytecode. Also Bottle has no depenencies, preventing dependency bloat.
I have just started learning Python 3 weeks ago. I want to create a REST API using python. The API will be used to save form data in an Oracle database. The front end is using AngularJS 8 with Angular Material. In python, there are so many frameworks to develop REST APIs.
I am looking for some suggestions which REST framework to choose?
Here are some features I am looking for:
Easy integration and unit testing, like in Angular. We just want to run a command.
Code packaging, like in java maven project we can build and package. I am looking for something which I can push in as an artifact and deploy whole code as a package.
Support for swagger/ OpenAPI
Support for JSON Web Token
Support for test case coverage report
Framework can have features included or can be available by extension. Also, you can suggest a framework other than the ones I have mentioned.
For starters flask provides a beautiful and easy way to create REST APIs. Also its supported by excellent beginner docs as well as a very active community. Another good thing with Flask is its widely available list of plugins which allow you to build as you go. Its also good in performance and can scale to a quite decent level. However, if you are sure your project is going to be fairly big, it would be better to start with Django as it provides a lot of features out of the box and is extremely stable in performance. Both these frameworks have support for Swagger, JWT, Coverage Report although you have to install plugins for them. Deploying both of these are fairly simple and there is huge documentation available. Django has one of the best documentations I have come across. I hope I was able to answer your queries.
We decided to expose our small machine learning (ML) pipeline as a REST API. This allows us to nicely separate concerns from the rest of the codebase. There are two very popular choices in Python for building APIs: Flask and FastAPI. We have experience with both, but find that FastAPIs use of static type hints and validation with Pydantic allow us to build better APIs faster.
We will use Django
to set up our backend and Django REST Framework
(DRF) for our API creation. The easiness of performing development tasks (eg. user authentication, URL routing, and schema migration) attracts our attention. Also, Django with PostgreSQL provides many benefits:
1. Some data types in Django will only work with PostgreSQL;
2. Django offers django.contrib.postgres to operate on PostgreSQL;
3. Django supports many features of PostgreSQL.
Moreover, Django is compatible with Redis.
Pros of Django REST framework
- Easy to use66
- Browsable api65
- Great documentation53
- Customizable50
- Fast development42
- Easy to use, customizable, pluggable, serializer9
- Python8
- Django ORM7
- FastSerialize5
- Less code3
- Easy implementation2
Pros of ExpressJS
- Simple381
- Node.js336
- Javascript244
- High performance193
- Robust routing152
- Middlewares73
- Open source72
- Great community59
- Hybrid web applications37
- Well documented16
- Sinatra inspired9
- Rapid development9
- Isomorphic js.. superfast and easy7
- Socket connection7
- Light weight5
- Npm4
- Resource available for learning4
- Callbacks3
- Event loop3
- Data stream2
- Easy to use1
Pros of Flask
- For it flexibility10
- Flexibilty and easy to use9
- Flask8
- User friendly7
- Secured6
- Unopinionated5
- Secure2
- Customizable1
- Simple to use1
- Powerful1
- Rapid development1
- Beautiful code1
- Easy to develop and maintain applications1
- Easy to setup and get it going1
- Easy to use1
- Documentation1
- Python1
- Minimal1
- Lightweight1
- Easy to get started1
- Orm1
- Not JS1
- Perfect for small to large projects with superb docs.1
- Easy to integrate1
- Speed1
- Get started quickly1
- Open source0
- Well designed0
- Flexibilty0
- Productive0
- Awesome0
- Expressive0
- Love it0
Sign up to add or upvote prosMake informed product decisions
Cons of Django REST framework
- Bad documentation2
- Reimplements Django functionality2
- No support for URL Namespaces1
- Bad CSRF handling0
Cons of ExpressJS
- Not python27
- Overrated17
- No multithreading14
- Javascript9
- Not fast5
- Easily Insecure for Novices3
Cons of Flask
- Not JS10
- Context7
- Not fast5
- Don't has many module as in spring1