1

AttributeError("'WSGIRequest' object has no attribute 'args'",) この電話をかけようとすると、これが得られ ます

GET /sign_s3/?s3_object_type=image/jpeg&s3_object_name=default_name

何か不足していますか?

*args, **kwargsリクエストに加えて含める必要がありますか?

トレースバックは次のとおりです。

            response = middleware_method(request, callback, callback_args, callback_kwargs)
            if response:
                break
    if response is None:
        wrapped_callback = self.make_view_atomic(callback)
        try:
            response = wrapped_callback(request, *callback_args, **callback_kwargs) ...
        except Exception as e:
            # If the view raised an exception, run it through exception
            # middleware, and if the exception middleware returns a
            # response, use that. Otherwise, reraise the exception.
            for middleware_method in self._exception_middleware:
                response = middleware_method(request, e)

景色:

@login_required()
def sign_s3(request):
    object_name = request.args.get('s3_object_name') 
4

3 に答える 3

5

HttpRequestオブジェクトに属性がありませんargs

使用する必要があります

request.GET.get('s3_object_name')

取得するs3_object_name value

Django のドキュメントには、 に関する優れたセクションがありHttpRequestます。

于 2014-01-16T21:37:12.083 に答える