Пытаюсь локально протестить платежную систему (локально работает она, поверено). Никак не пойму, как это пофиксить. Пробовал и через redirect, и через HttpResponseRedirect - результат аналогичен. Ругается на https, как я понял. Хотя url генерится правильный.

@login_required
def top_up_pay(request):
    template = 'payments/top_up_pay.html'
    conf_currency = AppConfig.get_config('subscription_price_currency')    #Стоимость заказа

    if request.method == "POST":
        amount = Decimal(request.POST.get('amount'))

    if conf_currency:
        req_user = request.user
        invoice = Invoice.objects.create(
            invoice_type=INVOICE_TYPE.TOP_UP,
            user=req_user,
            amount=amount,
            currency=conf_currency
        )
        params = {
            "currency": invoice.currency,
            "amount": int(round(float(invoice.amount) * 100)),
            'order_id': invoice.payment_no,
        }
        integration = FondyIntegration(params)
        redirect_to = integration.checkout_url()
        if request.is_ajax():
            response = HttpResponse(json.dumps({'success': True, 'location': redirect_to}),
                                    content_type="application/json")

            print(redirect_to)                     #https url
            return HttpResponseRedirect(str(redirect_to))   #405 error

        else:
            return redirect(redirect_to)
    elif conf_currency is None or conf_currency == '':
        raise ImproperlyConfigured("Key subscription_price_currency must be set in AppConfig items")
    elif conf_info is None or conf_info == '':
        raise ImproperlyConfigured("Key top_up_info must be set in AppConfig items")
    else:
        raise ImproperlyConfigured("Undefined error")

    return render(request, template, ctx)

https://docs.djangoproject.com/en/2.2/_modules/django/http/response/#HttpResponseRedirect