Dajax安装 [英] Dajax installation

查看:133
本文介绍了Dajax安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Dajax安装的严重问题。然而dajaxice正确地工作dajax没有回应。

INSTALLED_APPS =(
...
'dajaxice',
'dajax',
...) code>



TEMPLATE_CONTEXT_PROCESSORS =(...
django.core.context_processors.request,
...)



TEMPLATE_LOADERS =(
...
'django.template.loaders.eggs.Loader',



头部包含这些元素:




{%load dajaxice_templatetags%}



src =/ static / js / jquery.js
src =/ static / js / functions.js
src =/ static / js / jquery.dajax.core .js



{%dajaxice_js_import%}



除此之外,我有一个我的应用程序中有一个示例功能的 ajax.py 我应该更多吗?你看到任何错误有点晚 - 但我没有看到任何明显的错误,也许您可​​以先尝试获取一些有关信息的信息,然后点击确定,然后点击确定。公司oblem。你的settings.py是否有:

  DEBUG = True 

您可能需要向settings.py添加一些记录器 - 例如:

 'dajaxice':{
'handlers':['file','console'],
'level':'WARNING',
'propagate':True,
$,
'dajaxice.DajaxiceRequest':{
'handlers':['file','console'],
'level':'WARNING',
'传播':True,
},
}

你也不说明您的ajax.py是否导入了必需的模块,可能值得检查:

  from dajax.core import Dajax 
from dajaxice.decorators import dajaxice_register

从文档dajax需要jQuery 1.6.2(和以上从我的经验)。您使用的是什么版本?



最后 - 确保将注册装饰器添加到您的ajax.py函数,或者按照 http://docs.dajaxproject.com/dajaxice/ create-my-first-dajaxice-function.html#create-your-ajax-function



例如:

  @dajaxice_register 
def myexample(request):
return simplejson.dumps({'message':'Hello World'})

我爱Dajax / Dajaxice,虽然允许我(或我允许自己)进入大号的意大利面条碗代码循环在python / django& js。


I have serious problem with Dajax installation. However dajaxice work correctly dajax does not respond. INSTALLED_APPS = ( ... 'dajaxice', 'dajax', ...)

TEMPLATE_CONTEXT_PROCESSORS = ("... "django.core.context_processors.request", ...)

TEMPLATE_LOADERS = ( ... 'django.template.loaders.eggs.Loader', )

Head section contains those elements:

{% load dajaxice_templatetags %}

src="/static/js/jquery.js" src="/static/js/functions.js" src="/static/js/jquery.dajax.core.js"

{% dajaxice_js_import %}

Apart of it, I have ajax.py in one of my apps with sample functions. Should I do sth more? Do you see any mistakes ?

解决方案

Bit late - but I don't see any obvious mistakes. Perhaps you could first to try to get some information on the problem. Does your settings.py have:

DEBUG = True 

you might want to add some loggers to settings.py - e.g:

'dajaxice': {
   'handlers': ['file', 'console'],
   'level': 'WARNING',
   'propagate': True,
   },
'dajaxice.DajaxiceRequest': {
   'handlers': ['file', 'console'],
   'level': 'WARNING',
   'propagate': True,
   },
}

you also don't state whether or not your ajax.py has imported the required modules, might be worth checking:

from dajax.core import Dajax
from dajaxice.decorators import dajaxice_register

and from the docs dajax requires jQuery 1.6.2 (and above from my experience). What version are you using?

finally - make sure you add the registration decorator to your ajax.py functions, or otherwise register them as per the documentation http://docs.dajaxproject.com/dajaxice/create-my-first-dajaxice-function.html#create-your-ajax-function

For example:

@dajaxice_register
def myexample(request):
    return simplejson.dumps({'message': 'Hello World'})

I'm loving Dajax/Dajaxice, although it's allowing me (or I'm allowing myself) to get into a big of a spaghetti bowl of code looping back and forth between python/django & js.

这篇关于Dajax安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆