vue使用axios默认设置不携带cookie
需要设置

axios.defaults.withCredentials=true

后台python设置setting.py

CORS_ORIGIN_ALLOW_ALL = False

CORS_ORIGIN_WHITELIST = (
    '127.0.0.1:8080',
)

# If True, cookies will be allowed to be included in cross-site HTTP requests. Defaults to False.
CORS_ALLOW_CREDENTIALS = True
Logo

前往低代码交流专区

更多推荐