both seems to be pretty cool
which is to be in used in what scenario ?
GWT: http://code.google.com/webtoolkit/
Faster AJAX than you'd write by hand
With Google Web Toolkit (GWT), you
write your AJAX front-end in the Java
programming language which GWT then
cross-compiles into optimized
JavaScript that automatically works
across all major browsers.
Django: http://www.djangoproject.com/
a high-level Python Web framework that
encourages rapid development and
clean, pragmatic design.
They have little or nothing to do with each other. Django provides some Javascript; Django can easily handle the server-side of any Ajax conversation.
Django doesn't help you write javascript. It helps you write the server-side of the application.
Django helps you write the HTML pagess (with templates). If the page includes, or relies on Javascript, Django doesn't care very much at all.
pyjamas is a Python port of the GWT, so all the javascript is generated using Python instead of Java.
If you're planning on working with Django it might simplify to make your entire shop code in Python.
It is quite possible to use both in the same project. I've been working on such a project for some time now. Have Django handle the server side and leave the client side to GWT. The only issue I have is that the RPC mechanism in GWT cannot be used because it works with Java servlets. I use JSON for communication instead.
With GWT you write client-side applications, that run inside some browser Javascript engine. You code in Java, and it gets compiled into Javascript.
Django, is different because you write server-side applications: applications will be executed in the server and their result is sent to the client browser. Ah! Django is Python.
Both have libraries to achieve most of the tasks web developer needs, like internationalization, sessions, etc. Django comes with a nice ORM (Object Relational Mapper) and GWT comes with a Tomcat based engine, for the server-side coding and development.
If you need to make a decision just choose the framework based in the language of your choice.
I use xml serialization for communication between django and gwt
http://www.eecho.info/Echo/ajax/requestbuilder-gwt-15/
Related
I have been using Flask for Building REST API on the development level. I want to create REST API at Production Level. So which Python web framework would be Best?
These frameworks I saw while searching:
CherryPy
Flask
Django
Pyramid
TurboGears
Pylons
Web2py
Falcon
Bottle
Etc.
Django has a big support for REST API. According to my own experience I'd advice Django.
See more here: https://www.django-rest-framework.org/
For a REST API, I would use FastAPI. It has a strong reputation.
I have used it for several projects, and I like it because it fairly easily lets you do the right thing without much work. For instance, it relies upon pedantic to ensure the proper data types for what you are sending/receiving.
A client talks to Django, and django uses node.js to do some javascript related work to give back the client a http response.
I wonder how I should set up the link(?) between the django and node.js.
Simply, I could use python's requests library and talk http, but is this best I can do?
If I were to build the communication link in c++, I would create non-block socket with Send/Recv Thread and use mutex(or similar) between the django view code and the send/recv thread.
I guess that's what is called asynchronous io in node.js world.
Is there a similar thing in python so that I could use on django side to talk to another server?
I heard many big companies use Thrift, would it fit here?
I also see gevent might be relevant keyword here, but not sure.
I am not sure if my answer is still relevant, but I'll give it a try.
IMHO, the best solution for you would be to have a RESTful API for your Django app. This has several advantages:
it provides a lot of decoupling between your Django app and your Node.js one, so in case you ever want to reuse any of them or to replace one of them, it will be easy
it allows you to design an API for each of them and to hide the rest of your implementation (your Django app should not care how Node.js does its job, but only the response that it provides)
there are many great frameworks out there that can help you quickly build your APIs (at leat for Django there is Django REST framework)
If you don't want to build a RESTful API, python's request library is probably the best and easiest way.
Good luck.
I have read a couple of articles about using new JS frameworks like Backbone.js or Ember.js
I have come up to this statement:
If I use a JS framework like Backbone.js/Ember.js, I then move the logic from the back-end (Django) to the front-end.
Therefore, will Django actually be used only for its Models?
Does that mean that Django Views and Django Template are not needed anymore and the Django back-end is kinda turn into a "basic" REST API that will be consumed by the front end.
Do you agree? Is it then the purpose of Django in this case?
Is turning the django backend into a REST API one of the most suitable use case when using a framework like Backbone.js/Ember.js for the front-end?
Thanks.
Django is perfectly fine to be used this way, you still get the admin, the models, the orm and all the third-party plugins. However, it isn't blazingly fast, so if you're doing simple document level, non-relational REST mapping, you might wan't to look into node.js and mongoDB for instance.
If you're sticking with django (like we are, we like the structure it gives us), you can use one of the REST plugins:
Django Rest Framework A perfect match since DRF 2.0, under very active development!
Django Tastypie (checkout backbone-tastypie.js for integration)
Django Piston (might be a bit stale or has development picked up lately?)
If you only want to work with frontend development, checkout the Backend-as-a-Service places like cloudmine.me or firebase.com that handle all backend stuff for you, for a price of course.
Django may seem unnecessary once you start thinking about single page solutions and Javascript applications, but if you want your site to be 'fail proof' it wouldn't be impossible to develop both a client side Javascript version of the site as well as a backend django side incase the user, or your site's javascript, fails at some level. Of course this requires creating your site twice, and probably isn't needed in the age of modern browsers, but such would be one of the few instances where you would mix the two for a complete solution.
Yes, that's about it. You can use it to manage authentication to resources and such and maybe use a main view for your application but you won't need to use the server side templating since these frameworks are made to work with json/xml response.
That's why a lot of people are moving to lighter backend/backbone or ember combo instead of a complete solution like django. You can also use your django for caching json response which makes your application appears faster.
We are doing that and use django-piston to make it easier on you.
Normally you make your entire website under Django and only one page will be a "single app page" using backbone.js, usually that page is a very interactive page, with lots of small updates that occur frequently and need to be shown very fast to the user. This page, because of the large number of changes and user interactions is constructed on the client-side so that you are using his PC resources and not the server's, the rest of the pages can use django because it offers you a very stable and secure framework for the server-side
Historically I've mainly written web apps in Django, but now I'm increasingly finding that I want to write single-page web apps using Backbone.js or a similar JavaScript framework, with a back-end that solely consists of a database and an API.
My questions is this. If my application structure looks like this:
1. Database
|
v
2. API methods
|
v
3. Single-page front-end written with Backbone
and I'm most comfortable in Django - but also keen to learn new things too, such as NoSQL and Node, if they are appropriate - what would people recommend I use for (2)?
Typically I would use Django with Piston as the API app, but it seems rather heavyweight to have all of Django and only use it as an API provider. Perhaps I shouldn't be worrying, though.
If you use Django, which is an MVC framework, and use Backbone, you might be comfortable setting up your app in pure Node.js or Express.js, with additional modules for connecting to your choice of database.
With Express, if you plan to serve only JSON via RESTful interface, you don't even need to use Views, which is handy. You would only need to set up models and routes (that also serve as controllers).
Any server side framework or lang that is capable of supporting or providing for RESTful APIs should work. I myself as using Slim PHP right now. But seeing that you are from a Django/Python background perhaps this post would be helpful to you.
Recommendations of Python REST (web services) framework?
I'm building from scratch a web application that is not trivial (have some algorithms and calculations in the backend) but not too complex (it doesn't have to process lots of records during runtime.)
We thought about using Django for the backend in order to be able to develop the application fast with flex based GUI.
I'm a Java developer with no experience with Django so basically I wanted to know if using Flex and Django together is a good option in terms of ease of development and maintenance? I saw that there are several libraries such as pyAMF and DjangoAMF for this purpose, but since Django is also about html templates and MVC, does flex really work well with django?
Thanks
Django doesn't have to return HTML, that is just a common use case. Even in 'regular' web applications, a Django view might return json, xml, or yaml for an ajax response. You can use templates or not, whatever is easier for the task at hand.
You might find this article helpful - just substitute 'Django' wherever you see 'PHP'
http://www.adobe.com/devnet/flex/articles/flex_php_architecture_02.html