Django-cookies和session
设置cookies
- 存储cookies
1 | # views.py |
- 获取cookies
1 | request.COOKIES -> dict |
- 删除cookies
1 | HttpResponse.delete_cookies(key) |
设置session
- 添加配置
1 | # settings.py |
- 设置session
1 | request.session[key] = value |
- 获取session
1 | value = request.session.get(key, default) |
- 删除session
1 | del request.session[key] |
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.