views:

512

answers:

4

Hi all,

I was planning to write a new webapp, I figured out two options for my backend - web2py or django.

I recently came across jQuery and found it to be very cool.

Could I just use jQuery as a replacement for django and web2py and finish this webapp.

Some features that I'm going to implement - user profiles, users can add content to the website, etc.

Is it possible to do solely in jQuery ?

+4  A: 

No. jQuery is a client side technology as opposed to the 2 server side frameworks you mentioned.

elias
A: 

To build a web user interface jQuery is perfect. But I assume, unless you write an opensocial app that runs inside an os-container, you need a backend on the server-side.
The backend is responsible for i.e. the data storage. It also provides a lot of useful prebuilt libraries for authentication, session handling and so on... So I suggest you to combine jQuery with a popular web framework like Django.

aeby
+5  A: 

It's definitely possible to do all of the front-end in Javascript on the client's browser (unless you have to support JS-less or very old browser), reducing the server's role to that of offering a REST-ish interface for the client's AJAX calls (as well of course as serving static files of various sort;).

This approach is known as thin-server architecture and jQuery (just as much as, say, Dojo or Closure) is suitable for implementing the client-side part of it. If you can restrict yourself to advanced browsers with HTML5 goodies, you can do even more client-side, further lightening the load on your server and enhancing scalability (how much you can demand of the browser varies widely with your app, of course -- if it targets iPhone, Android or other advanced mobile phones specifically, or if it's an enterprise-internal web app where the users can be made to use Chrome or Safari, say, you can be far more demanding than if you want millions of random users out on the open web;-).

For the server-side part I'd suggest an ultralight microframework on top of Werkzeug and WSGI, such as Flask or (if the server uses App Engine) tipfy (there are others, esp. for GAE -- see here for a list).

I would not place on the client-side anything that needs "security", though - since all of your Javascript code, jQuery or not, can be examined and hacked easily, anything you want to be "safe" should live server-side.

Alex Martelli
I've been using jQuery with [Sammy](http://code.quirkey.com/sammy/) and [PURE](http://beebole.com/pure/), and it's been working pretty well (only on a small scale so far).
Ian Bicking
But Alex,i doubt his ability to understand what you said here!!
Srinivas Reddy Thatiparthy
+2  A: 

No. jQuery is for client-side interfaces. web2py and Django are for server-side. You need both. In fact web2py contains jQuery and has many plugins that combine client-side and server-side functionality and are based on jQuery (http://web2py.com/plugins). jQuery is agnostic on which server-side framework you use (web2py, Django or other) and server-side frameworks are also agnostic on which client library you use (jQuery, prototype, etc.). In the web2py world we tend to prefer jQuery.

EDIT: you can move a lot (if not all) of the presentation from the server to the client but you still need centralized storage which requires the serverside part.

mdipierro