Код, который вы показали, описывает мутацию GraphQL.Это не имеет ничего общего с взаимодействием с пользователем.
class CreateSample( Mutation ): # <-- Mutation name
class Arguments:
input = SampleInputType() # <-- Mutation takes one argument
Output = SampleSchema # <-- Mutation returns object with type SampleSchema
async def mutate( self, info, input ):
result = do_something()
return CreateSample(Output=result) # <-- Mutation must return self type
Вы можете вызывать мутации только с помощью какого-либо клиента GraphQL, такого как клиент Apollo или Graphiql.Поэтому возврат response.redirect не создает сцен.
Вы можете вернуть response.redirect () только внутри стандартного маршрута.Что-то вроде -
@app.route('/<path:path>')
def index(request, path):
"""Catch all requests"""
return response.redirect( 'https://www.google.com' )