Django or Flask or Falcon for Microservices [closed] - django

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
Why is Microservice Architecture better than monolithic architecture? I know the answer will be because the microservice architecture is more scalable and each service is independent of each other etc.
My following question is: should we build using Flask or Django REST Framework?
I have also heard of a framework know as Falcon as per there documentation seems good enough.

Microservices is an architecture, not a web* framework choice
I don't think whether your app turns out to be a monolith or a microservice depends on the web framework that you are using (e.g. Django or Flask)
*Unless we're talking about frameworks specifically built to deal with managing microservices (e.g. to facilitate service discovery) web frameworks like Django or Flask are pretty equivalent (input HTTP request, output HTTP response)
Maybe their perceived popularity in a given use case (e.g. Django monolith or Flask microservice) may suggest they are better suited for a particular deployment style, but you could a microservice with Django just as easily as you can a monolith with Flask.
For instance, if I select Flask as my web framework, and in a single Flask app/process I implement all of the services (auth, admin, reporting, payroll, marketing, billing, messaging, search etc), where everything communicates on the code level, then I'd end up with a monolith.
On the other hand, if for instance I take Django, and divide my services into several small Django deploys, and make it so they only communicate through well defined HTTP contracts, and can be updated/deployed independently, then I'd end up with a microservice.
Bottom line is, a microservice is more than just the web framework you use, so use whichever one you like the most, until you have more specific requirements and e.g. 3rd party libs that are useful to you and are only available for a given framework but not the other.

Related

Nextjs, Gatsby for Server-side-rendering of an e-commerce website with Django at the backend? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I want to make an e-commerce web app, where at the backend I am using Django and Django Rest Framework.
I want to use React, Redux and React-Router with axios library at frontend. I found-out that these are two other framework for React i.e. Nextjs and Gatsby.
Now, Which one will be better for me to make an e-commerce web app between Nextjs and Gatsby?
And, Is it necessary to use Redux, React-Router with Nextjs and Gatsby?
It all depends on, what are the important performance related features you want to have in your app? I assume you have the basic understanding of how these both frameworks work. Still, I'll try to make it as brief as possible.
NextJs uses Server-side rendering(SSR) which is good for your SEO and initial site load. It uses a concept of pages, meaning each page is in itself a route. So you don't need to implement React-router separately. It has it's own routing mechanism which can be found in here.
Gatsby is a static site generator tool. A static site generator generates static HTML on build time. It doesn’t use a server. Gatsby uses GraphQL which is a query language and if you’re familiar with SQL, it works in a very similar way. Using a special syntax, you describe the data you want in your component and then that data is given to you.
The fundamental difference is, NextJs requires a server to be able to run. Gatsby can function without any server at all. Gatsby just generates pure HTML/CSS/JS at build time, whereas NextJs creates HTML/CSS/JS at run time. So each time a new request comes in, it creates a new HTML page from the server.
And yes Redux implementation is consistent across these platforms and other state management. Though the Gatsby needs some plugins to get started with it. NextJs setup is similar to create-react-app's. And it entirely depends whether you want to go with redux or not. It has a specific use-case. Nowadays, you have partial solutions for these use-cases i.e contextAPI, hooks etc. But still you need redux for many others, where these limited solutions won't work.
So, If your back-end is in GraphQL, I would recommend to look into Gatsby, it provides some of the powerful solutions for front-end. That said, I would recommend you to go on with NextJs, if you are using any other back-end architecture. I myself had implemented an e-commerce site in NextJs and I must admit It was a great working experience for me.

Do I really need Django Rest Framework to develop Restful api with Django? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I am learning Django to develop api, but I find that most of the tutorials on the web are all use Django Rest Framework. Does it really need this framework to develop restful apis? Can I develop restful apis without Django Rest Framework
Of course you can develop a rest API without DRF - a rest API is just a set of urls mapped to views that take HTTP requests and return HTTP responses, period. Now since most often "rest API" implies JSON as the default input and output format and a proper use of HTTP verbs, some specific kind of auth etc there are some repetitive tasks that can be factored out - either rolling your own mini-framework, using an existing lightweight one like restless, or trying to find your way in the 800-pound gorilla DRF.
Of course, you can but why, when Django Rest Framework does the work for you ? If you wanna learn how it's working just use Django Rest Framework and watch the sources code of it.
Surely you can develop REST API with django, Django Rest Framework isn't part of Django project its a third party tool which facilitate faster API development. DRF takes care of lot of stuff which you need to take care by your own otherwise like.
Handling token
Authorization
Authentication
Serialization & Deserialization of dataobject
likewise many other.

Do I even need Django? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I'm currently building a website where vendors from my city can authenticate and post their products, so users can search and buy them.
I started building the website with Django; in the meantime, I was taking a beautiful ReactJS 30+ hours online course and learning how much you can do with it: not only pure frontend, e.g. Routing, GET/POST requests, Forms and validation, Authentication. My initial idea was building the website with Django Rest (backend) AND React (frontend),.
But now I have a question:
Can I build my buy&sell website with React ONLY? (maybe using some pre-made backend networks like Firebase to save/fecth data to/from a database, to save time).
In your opinion would I need some backend functionalities which would be impossible/inconvenient to implement with React, Firebase or other services? Please consider that I'm talking about a quite standard buy and sell website with authenticated vendors and buyers.
Thank you very much for any advice.
While you don't need to use Django, you do need to use some backend framework to connect to your database or data store. So, to answer your main question directly, you probably need some other backend system to serve your data, manage authentication tokens, etc.
Django makes it pretty simple to wire up to a REST API (Django REST Framework is my preference, too), but you might be able to get everything you need done with NodeJS, and without Django.
Even still, you're looking at some type of backend, even with NodeJS and a simple NoSQL datastore.
I think you're on the path of least resistance by using Django, DRF, and React, and with a robust database like PostGreSQL.

How Django ORM, REST API and a Web app stack up? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm trying to develop a web application in Django including a REST API and also a web application to allow user to login and see stuff. I'm a bit confused as to how these are connected together.
I'm thinking that Django ORM is at the bottom and on top of that comes the API and then the web app uses the API to generate HTML. Is this correct understanding? A yes or no with few {key}words explanation would be enough.
What is the best practice?
Basically Django ORM is the bottom layer in your app as it will make possible to manipulate your data. When it comes to APIs, the main goal is to make accessible and manipulable your data from different devices (clients), for instance your web app and your iOS app may consume the same API and that will reduce your implementation time and eventually it will give you a better integration through your different clients and devices. Last but not least, the Web app is at this point the consumer to your API and your front-end.
You could check Tastypie or Django REST framework/ in order to implement your API and for your web app you have plenty of frameworks that you could use as Backbone, AngularJS etc.

Confused about making Django Asynchronous (RealTime) [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Better Technology to Make a Django project Asynchronous (RealTime) (using Tornado with django ORM or Node.js ),
Node.js is really Tough to code.
I followed a tutorial : Using Django Inside the Tornado Web Server.
[http://lincolnloop.com/blog/2009/sep/15/using-django-inside-tornado-web-server/][1]
Solution :
i've developed a package for django called django-realtime . It may be helpful for other devs facing the same issue i have faced before
https://pypi.python.org/pypi/django-realtime/1.1
Django IMO shouldn't be used as an Asynchronous application, it's not designed for that. If you want a real time application using things like web sockets you'll need to separate your concerns.
I'm building a real time application with Django as the MVC framework for serving the site and any RESTy API calls, Gevent SocketIO as the Web Sockets Server for the real time bit and Redis Pub/Sub (will switch out for ZeroMQ) as the message transport for various different parts of the application to comunicate with the socket server and emit events.
Take a look at https://github.com/abourget/gevent-socketio. It does have a Django integration component but imo it's a bit magical, I would use it to build a separate web socket server, keep things simple.
Django and Celery are well working together.
You'll find on the web many infos, but the best places to look are
the Celery Website : http://www.celeryproject.org/
the Django-celery module : https://pypi.python.org/pypi/django-celery
But using Celery is really not mandatory. Since Django can operate any of the Python modules (or near), you can simple use RabbitMQ (as a broker) and use amqp (https://pypi.python.org/pypi/amqp) which is a fork of amqplib (https://pypi.python.org/pypi/amqplib).
Basically, any how-to you'll find about Python + AMQP should work for Django.