我的路由器在Django Rest Frame Work 1.11上工作,但此代码在Django Rest Frame Work 2下不工作

时间:2018-06-19 14:41:09

标签: django django-rest-framework

def post(self):
    try:
        # Store request remote ip
        body = json.loads(self.request.body)
        command = body['command']
        if command == 'ping':
            **--> UPDATE "A" Record with this IP: <self.request.remote_addr>**
    except:
        raise Exception("bad request!")

这是我的错误

Trip_router.register(r'places', views.PlaceViewSet, base_name='trips-places')\
.register(r'people', views.PersonInPlaceViewSet, base_name='trips-places-people')

AttributeError:'NoneType'对象没有属性'register'

0 个答案:

没有答案