我有一个名为“run_test”的特殊 Django 管理操作。
我想从詹金斯的工作开始对某些项目采取行动。
像这样的东西是我的主意
import json
import requests
url = "http://localhost:8000/admin/app/model/"
item = { "user": "jenkins",
"password": "password",
"action": "run_test",
"index": 0
}
headers = {"Content-Type":"application/json","Accept": "application/json"}
resp = requests.post(url,data=json.dumps(item),headers=headers)
print(resp)
403 是我得到的答复。
有没有办法使用 curl 或 request.post 运行 Django 管理命令?
如何包含查询集?
注意:manage.py 命令不是一个选项