Iv. Cookies
1. Obtaining Cookies:
1 request. cookies[' key ']2 Request.get_signed_cookie (Key, Default=raise_error, salt= ', max_age= Salt: Encryption Salt 6 max_age: Background control Expiration Time
2. Set Cookies:
1 rep = HttpResponse (...) or rep = render (Request, ...) 2 Rep.set_cookie (key,value,...) 4 Rep.set_signed_cooki E (key,value,salt= ' crypto salt ' key, key 7 value= ", value 8 max_age=None, Time-out 9 Expires=none, Time-Out (IE requires expires, so set it if hasn ' t been already.) Path= '/', cookie in effect path,/ indicates root path, Special: Cookie with path can be accessed by any URL of the page domain=None, the domain name of the cookie takes effect secure= False, HTTPS transmission Httponly=false can only be transmitted by HTTP protocol, cannot be obtained by JavaScript (not absolute, the underlying capture can be obtained or overwritten)
Because cookies are stored on the client's computer, JavaScript and jquery can also manipulate cookies.
1 <script src= '/static/js/jquery.cookie.js ' ></script>2 $.cookie ("List_pager_num", 30,{Path: '/'});
The path of Python--web--2--django-7-cookie