2015-04-04 115 views
1

我在此代碼中生成帶有Celery任務的圖像。這是ajax視圖函數的一部分。502網關 - ajax響應 - django

task_result = generate_result_image.apply((answer, combi.id, lang)) 
if task_result.state == "SUCCESS": 
    response['ok'] = 'yes' 
    return HttpResponse(json.dumps(response), content_type='application/json') 

這是在本地工作完美,但在prod服務器,我得到502壞的網關。這是瀏覽器控制檯消息:

enter image description here

我究竟做錯了什麼?這真的很神祕..

這是uwsgi日誌,光標所在的那一行是我正在做的調用。我看來,工人我的電話......不知道爲什麼之後死亡..

enter image description here

+1

這可能是關於你的nginx + uwsgi配置(如果我沒記錯你的設置)。 – alecxe 2015-04-04 04:56:17

+1

@alecxe hey alex,我需要在nginx + uwsgi conf中爲ajax設置其他的東西嗎? – doniyor 2015-04-04 04:57:27

+1

不確定這會有所幫助,但快速谷歌搜索指向它:http://stackoverflow.com/questions/11529288/nginx-django-502-bad-gateway,http://stackoverflow.com/questions/17319896/502 -bad-gateway-django,http://serverfault.com/questions/504901/nginx-502-bad-gateway-runing-django-in-uwsgi。 – alecxe 2015-04-04 04:59:04

回答

0

問題就迎刃而解了 - 該位是不是我的代碼,也不是我的設置,但我將文件發送到遠程服務器,來生成圖像。非常感謝亞歷克斯顯示正確的方向..