2012-12-19 27 views
1

我正在用dajaxice(0.5.4)運行Django(1.4.3)。我有一個文件ajax.py我在叫prj主要項目文件夾,它看起來像功能:dajaxice.core.js沒有更新ajax.py中的函數

from dajax.core import Dajax 
from dajaxice.decorators import dajaxice_register 
from django.utils import simplejson 
from dajaxice.core import dajaxice_functions 
from django.core.urlresolvers import reverse, resolve 

def getContent(request, *args, **kwargs): 
    url = kwargs['url'] 
    try: 
     v = resolve(url) 
    except: 
    data = [] 
    data.append(('some','data')) 
    return simplejson.dumps(data) 
dajaxice_functions.register(getContent) 

我跑python manage.py collectstatic,我得到下面的輸出:

Copying '/tmp/tmpm8OlOw' 

然而,所產生的dajaxice.core.js不是根本就沒有我的功能getContent。我哪裏錯了?我希望,我已經正確安裝了dajaxice和所有的東西。

回答

0

看來你忘了打電話從urls.pydajaxice_autodiscover()(這是由dajaxice筆者推薦的地方)

此調用將加載ajax.py模塊,使它的方法,發現通過JS代碼生成