2012-06-18 30 views
0

我有嚴重的Dajax安裝問題。但是,dajaxice正常工作,dajax沒有迴應。 INSTALLED_APPS = ( ... 'dajaxice', 'dajax', ...)Dajax安裝

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在我的一個應用程序與示例函數。我應該做更多?你有沒有看到任何錯誤?

+0

什麼是錯誤?這種方式更容易 – Goin

+0

甚至沒有錯誤,似乎django根本沒有看到Dajax;( – user1403568

+0

有些錯誤應該有,可能這個錯誤是一個javascript錯誤 – Goin

回答

1

位遲了 - 但我沒有看到任何明顯的錯誤。也許你可以先嚐試獲得關於這個問題的一些信息。請問您的settings.py有:

DEBUG = True 

你可能想添加一些伐木者的settings.py - 如:

'dajaxice': { 
    'handlers': ['file', 'console'], 
    'level': 'WARNING', 
    'propagate': True, 
    }, 
'dajaxice.DajaxiceRequest': { 
    'handlers': ['file', 'console'], 
    'level': 'WARNING', 
    'propagate': 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

例如:我愛Dajax/Dajaxice

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

,儘管它允許我(或者我允許自己)進入一個代碼循環來回的python/django js。