2017-11-10 160 views
-1

我寫電報的機器人爲telebotDjango。當我在服務器上運行他並觀看完整日誌時,我有下一個文本:Bot沒有返回HttpResponse對象。它返回None而不是

Internal Server Error: /bot/ 
Traceback (most recent call last): 
    File "/home/fishbot/env/lib/python3.5/site-packages/django/core/handlers/exception.py", line 41, in inner 
    response = get_response(request) 
    File "/home/fishbot/env/lib/python3.5/site-packages/django/core/handlers/base.py", line 198, in _get_response 
    "returned None instead." % (callback.__module__, view_name) 
ValueError: The view bot.views.bot didn't return an HttpResponse object. It returned None instead. 

有人幫助我嗎?

P.S我不能在標籤0附加telebot

回答

1

在Django中,您必須在您的視圖返回HttpRequest實例。

試着做這樣的事情:

from django.http import HttpResponse 

def current_datetime(request): 
    response = '' # Put whatever you want to return in here. 
    return HttpResponse(response) 
+0

THX!這幫助了我 –

相關問題