您好,我很难解决这个问题,我有 djangographql服务器,当我在失眠中查询它时,它正在为我的本地计算机端口运行,8000一切正常,但我正在与前端集成reactjs,但axios出现错误:
xhr.js:178 OPTIONS http://127.0.0.1:8000/graphql/ 405 (Method Not Allowed)[enter image description here][1]
Run Code Online (Sandbox Code Playgroud)
我的settings.pyDjangographql服务器
我的前端请求ReactJs使用Axios:
export function getProducts(args = {}) {
return (dispatch) => { // optionally you can have getState as the second argument
dispatch({type: HOME_GET_PRODUCTS_BEGIN});
const promise = new Promise((resolve, reject) => {
const query = {
url: 'http://127.0.0.1:8000/graphql/',
method: 'POST',
headers: {
"Accept": "application/json",
'Content-Type': 'application/json'
},
data: {
query: `products{
userKey{ …Run Code Online (Sandbox Code Playgroud)