Is there a framework like now.js for Django? [closed]
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 questionI'm looking for a framework that would let me just update data in the structures and not to deal with queries and views every time.
I know, it can be better to use Node & express, but I've already tried, and feel that I can leverage Django better.
I know the thread is pretty old but to answer it :
I found this :
http://dajaxproject.com/
example from the website :
ajax.py
from django.utils import simplejson
from dajaxice.decorators import dajaxice_register
@dajaxice_register
def dajaxice_example(request):
return simplejson.dumps({'message':'Hello from Python!'})
html
<input type="button" name="rand" value="Get message from server!" id="rand" onclick="Dajaxice.examples.dajaxice_example(my_callback)">
javascript
function my_callback(data){
alert(data.message);
}
I couldn't get it to work with "production standards" ...
The real magic of now.js is also that you've got JS on both side and thus no objects to convert/(un)serialize
I was thinking about a setup like this :
DJANGO <-> NODEJS <-> NOW <-> BROWSER
Django could send objects serialized as json to node who would do the rest ...
I guess that would be somewhat tricky ... I also thought about going the other way around : meaning getting all django nice features (models,(auto)admin,templates,urls,middleware...)
I couldn't find anything as nice as django (contrib) admin !! If anyone knows ?
精彩评论