<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>hirokiky</author_name>
  <author_url>https://blog.hatena.ne.jp/hirokiky/</author_url>
  <blog_title>Make組ブログ</blog_title>
  <blog_url>https://blog.hirokiky.org/</blog_url>
  <categories>
    <anon>Django</anon>
  </categories>
  <description>DjangoでCookieを設定するときは response.set_cookie を使います。 response = TemplateResponse(...) response.set_cookie(&quot;key&quot;, &quot;value&quot;, max_age=3600) 今まで知らずに expires も自分で計算して設定していましたが、 max_age を指定して expires を指定しない場合は勝手に設定されるので不要みたいです。 DjangoのHttpResponseBaseのset_cookieにこういう実装がありました（Django 2.1で確認）。 if max_age is not N…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fblog.hirokiky.org%2Fentry%2F2019%2F02%2F19%2F113422&quot; title=&quot;Djangoのresponse.set_cookieはmax_ageを指定すればexpiresが勝手に計算される - Make組ブログ&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2019-02-19 11:34:22</published>
  <title>Djangoのresponse.set_cookieはmax_ageを指定すればexpiresが勝手に計算される</title>
  <type>rich</type>
  <url>https://blog.hirokiky.org/entry/2019/02/19/113422</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
