从 API 接收 url 的 Django 问题

时间:2021-02-11 19:37:07

标签: python django api url

以下是来自 API 的重定向链接 我想呈现我的 urls.py

<块引用>

http://127.0.0.0:8000/test-pay-redirect?token=60257a578aedc20bd1a6892c&mode=popup&tap_id=chg_TS014820212148r1N41102850

re_path(r"^test-pay-redirect/",views.paytestredirect,name='test_pay_redirect'),

path("test-pay-redirect/",views.paytestredirect,name='test_pay_redirect'), 我两个都试 但它无法连接到这个网址

2 个答案:

答案 0 :(得分:0)

请尝试删除 url 路由中的尾部斜杠!?

path("test-pay-redirect", views.paytestredirect, name='test_pay_redirect')

答案 1 :(得分:0)

我为您创建了一个简单的演示项目。 https://github.com/michaelhaar/Answer-for-Stackoverflow-66160632

运行 python manage.py runserver 命令并访问 http://localhost:8000/test-pay-redirect/?token=60257a578aedc20bd1a6892c&mode=popup&tap_id=chg_TS014820212148r1N41102850

您应该会看到如下内容: enter image description here

相关问题