Designing Web Applications with Multiple Frameworks

frameworksweb-apiweb-development

i'm relatively new to web development and i wanted to understand what does it mean when someone say "they used django for backend and javascript frameworks for front end."

please correct me if i'm wrong; my understanding is that they're making all their server side code i.e dealing with database and writing complex business logic, writing api's using python django framework and then they're using MVC such as AngularJS and using javascript to make API calls to the servers? (APIs exposed by python)

Also i'm right in my assumption; i wanted to know

1) why would someone use two different frameworks? i mean django can do both frontend as well as backend. What are the benefits and drawbacks. are there any limitations?

2) does this mean; all the communications between the two frameworks are dependent on API/RPC calls?

P.S; this is what i read but i have read same in several other places as well

/*"Our client side app is built on a fairly sophisticated JavaScript
framework and makes use of jQuery, React, Flux and all the usual
suspects. The server-side is written in Python on Django, with a MySQL
database. We use Node.js and SockJS for our real-time components. Our
systems all run on Amazon Web Services.

You will be will be working a variety of projects relating to our
flagship web application. These will include front-end MVC application
design and development, DOM optimization, and modular and extensible
HTML/CSS . In terms of back-end development, you will be working on
our Django application and creating lightning-fast REST APIs."*/

Best Answer

'Framework' is a generic term.

Django is a web development framework built on top of Python. It provides commonly needed tools for creating a website: tools like connecting to a database layer, running a development server, rendering views, and routing requests to the correct controller are all provided by the framework.

Rails is a similar framework, just built on Ruby. Theoretically you could create a web app in just Python or just Ruby without the framework, but it would be a pain to rebuild all those tools from scratch.

Angular is a front-end framework for creating interactive HTML views out of standardized data structures - take a look at the section on their home page about 'wiring up the backend'. Angular does not have a way to 'save' data beyond basic Javascript tools like saving to cookies or local storage; it needs a backend system for that. It uses some of the same language to describe code organization (such as "MVC") but it is not providing the same tools.

Front-end frameworks do not do the same things as back-end frameworks, and indeed, sometimes one front-end framework doesn't do the same things as a different front-end framework.


Web developers use 'front-end' and 'back-end' frameworks for handling two different types of interaction with the user.

django can do both frontend as well as backend.

Unless I dramatically misunderstand Django's abilities, it cannot create dynamic in-page interactions such as modal pop-ups, live editing, etc. It can render HTML, yes; but it cannot make any text you type into the text box also appear on the page simultaneously.

Back-end frameworks such as Django, Rails, or Symphony are used to handle idempotent browser requests and HTTP calls. You load a page, the framework inspects the url that you have requested and builds the entirety of the page, piece by piece, and returns the whole thing to the browser. (APIs too)

There are some exceptions to this, but in general when you "navigate" around the internet, "back-end" systems are handling those requests. When you see the URL change and the whole browser window whites out for a moment, that is this type of navigation.

"Front-end" frameworks are more important for handling in-page user interactions. Things like modal pop-ups, loading more data via AJAX without loading a new page, submitting a form and displaying a message without redirecting, hover effects.

The simplest front-end framework that you can use is just HTML plus CSS. If you need more complex interactions, you can add Javascript to those tools. If your javascript is complicated or you are recreating common patterns, you might add jQuery for it's animation tools.

If you find yourself reimplementing an entire application (replacing the entire content of the page when you click certain links or take certain actions - a "Single Page App"), then you might use a Javascript framework like Angular to build up those interactions.

Rarely will you see a front-end-only web application. Just about any website or application will require some sort of persistent data storage - logins, page content, comments, product data, user-submitted content, anything. The backend framework then acts as a communication layer between the database and disk and the front end. It could do as little as providing a simple REST API for accessing/creating/editing data while the Javascript handles all templates and HTML, or it could build out HTML partials, and the Javascript front-end assembles them together, or it could assemble the entire page, and Javascript is used only for animations and occasional Ajax requests.