[英]Django Dajax vs Dajaxice
This may be a very silly question but I'm looking at implementing ajax in my django project and the big plugin seems to be dajax/dajaxice however I can't for the life of me distinguish between the two. 这可能是一个非常愚蠢的问题,但我正在寻找在我的django项目中实现ajax而大插件似乎是dajax / dajaxice然而我不能为我的生活区分这两者。 Could someone clear this up a little for me?
有人可以为我清理一下吗? Thanks.
谢谢。
ATTENTION: 注意:
Should I use django-dajax or django-dajaxice?
我应该使用django-dajax还是django-dajaxice?
In a word, No. I created these projects 4 years ago as a cool tool in order to solve one specific problems I had at that time.
总而言之,我在4年前创建这些项目是一个很酷的工具,以解决我当时遇到的一个具体问题。
These days using these projects is a bad idea.
这些天使用这些项目是一个坏主意。
https://github.com/jorgebastida/django-dajax https://github.com/jorgebastida/django-dajax
Dajaxice is the core of the project, to quote the website: Dajaxice是该项目的核心,引用该网站:
'Its main goal is to trivialize the asynchronous communication between the django server side code and your js code.' “它的主要目标是简化django服务器端代码和你的js代码之间的异步通信。”
This means that a django / python method on the server like: 这意味着服务器上的django / python方法如:
from django.utils import simplejson
from dajaxice.decorators import dajaxice_register
@dajaxice_register
def multiply(request, a, b):
result = int(a) * int(b)
return simplejson.dumps({'result' : result})
Can be called on the client using javascript: 可以使用javascript在客户端上调用:
var result = Dajaxice.calcualator.multiply(1, 2);
console.log("Dajax says 1 * 2 = "+result);
Dajax provides a series of tools that incorporate dajaxice but requires less Javascript to be used, instead relying on more Python. Dajax提供了一系列包含dajaxice的工具,但需要使用较少的Javascript,而是依赖更多的Python。 The multiple example is here .
多个例子就在这里 。
I have used dajaxice on a few projects without using dajax. 我在几个项目中使用了dajaxice而没有使用dajax。 Also worth mentioning is Tasty Pie this creates a similar interface on the server, and using JQuery ajax helper functions like
.post()
, client side, little additional code is required in javascript compared to dajaxice. 另外值得一提的是Tasty Pie,它在服务器上创建了一个类似的接口,并且使用JQuery ajax辅助函数,如
.post()
,客户端,与dajaxice相比,javascript中需要一些额外的代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.