{"id":49202,"date":"2023-12-31T15:17:36","date_gmt":"2023-03-07T16:58:41","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90django-allauth-ver0-56%e3%80%91nameerror-name-allauth-is-not-defined%e4%b9%8b%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95%e3%80%82\/"},"modified":"2024-05-04T16:09:22","modified_gmt":"2024-05-04T08:09:22","slug":"%e3%80%90django-allauth-ver0-56%e3%80%91nameerror-name-allauth-is-not-defined%e4%b9%8b%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95%e3%80%82","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90django-allauth-ver0-56%e3%80%91nameerror-name-allauth-is-not-defined%e4%b9%8b%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95%e3%80%82\/","title":{"rendered":"\u3010django-allauth ver0.56\u3011\u201cNameError: name &#8216;allauth&#8217; is not defined\u201d\u4e4b\u89e3\u51b3\u65b9\u6cd5"},"content":{"rendered":"<h1>\u9996\u5148<\/h1>\n<p>\u5728\u5f00\u53d1\u5e26\u6709\u7528\u6237\u8eab\u4efd\u9a8c\u8bc1\u7684Web\u5e94\u7528\u65f6\u5728Django\u4e2d\u53d1\u751f\u7684\u9519\u8bef\u3002<\/p>\n<p>\u4e3a\u4e86\u6dfb\u52a0\u7528\u6237\u8ba4\u8bc1\u529f\u80fd\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5django-allauth\uff0c\u5e76\u5c06\u5176\u6dfb\u52a0\u5230settings.py\u7684INSTALLED_APPS\u4e2d\uff0c\u5982\u4e0b\u6240\u793a\u3002<\/p>\n<pre class=\"post-pre\"><code>INSTALLED_APPS = [\r\n    'django.contrib.admin',\r\n    'django.contrib.auth',\r\n    'django.contrib.contenttypes',\r\n    'django.contrib.sessions',\r\n    'django.contrib.messages',\r\n    'django.contrib.staticfiles',\r\n    'allauth', #\u3053\u306e\u884c\u3092\u8ffd\u52a0\r\n    'app', #\u30a2\u30d7\u30ea\u540d\uff08\u4eca\u56de\u306f\u95a2\u4fc2\u306a\u3057\uff09\r\n]\r\n<\/code><\/pre>\n<p>\u5728\u6267\u884c\u4e86\u4e00\u7cfb\u5217\u7684\u64cd\u4f5c\u4e4b\u540e\uff0c\u6211\u5c1d\u8bd5\u4f7f\u7528python manage.py runserver\u542f\u52a8\u672c\u5730\u670d\u52a1\u5668\uff0c\u4f46\u662f\u51fa\u73b0\u4e86\u4ee5\u4e0b\u9519\u8bef\u3002<\/p>\n<p>allauth.account.middleware.AccountMiddleware\u7684\u540d\u79f0\u9519\u8bef: &#8216;allauth&#8217;\u672a\u5b9a\u4e49<\/p>\n<p>\u770b\u8d77\u6765allauth\u6ca1\u6709\u5b9a\u4e49\u3002<br \/>\n\u867d\u7136\u5df2\u7ecf\u6dfb\u52a0\u5230INSTALLED_APPS\u4e2d\uff0c\u4f46\u4e3a\u4ec0\u4e48\u6ca1\u6709\u5b9a\u4e49\uff1f<\/p>\n<h1>\u8fd0\u52a8\u73af\u5883<\/h1>\n<h5>\u64cd\u4f5c\u7cfb\u7edf (Caozuo xi tong)<\/h5>\n<p>\u30fbWindows 10\u4e13\u4e1a\u7248<\/p>\n<h5>\u6a21\u5757<\/h5>\n<p>\u30fbDjango 4.1.1<br \/>\n\u30fbdjango-allauth 0.56.1<\/p>\n<p>&#8211; Django 4.1.1<br \/>\n&#8211; django-allauth 0.56.1<\/p>\n<h1>\u539f\u56e0\u4e0e\u89e3\u51b3\u65b9\u6cd5<\/h1>\n<p>\u6839\u636e\u5f80\u5e38\u4e00\u6837\uff0c\u8bf7\u6559GPT\u5148\u751f\uff0c\u5e76\u63d0\u51fa\u9519\u8bef\u62a5\u544a\uff0c\u636e\u8bf4\u8fd9\u6b21\u7684\u9519\u8bef\u662f\u7531\u4e8e\u4e2d\u95f4\u4ef6\u914d\u7f6e\u4e0d\u8db3\u9020\u6210\u7684\u3002<\/p>\n<p>ChatGPT: https:\/\/chat.openai.com\/<\/p>\n<p>ChatGPT\uff1ahttps:\/\/chat.openai.com\/<\/p>\n<p>\u8981\u8ba9\u5176\u6b63\u5e38\u8fd0\u884c\uff0c\u9700\u8981\u5728settings.py\u7684MIDDLEWARE\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\u3002<\/p>\n<pre class=\"post-pre\"><code>MIDDLEWARE = [\r\n    'django.middleware.security.SecurityMiddleware',\r\n    'django.contrib.sessions.middleware.SessionMiddleware',\r\n    'django.middleware.common.CommonMiddleware',\r\n    'django.middleware.csrf.CsrfViewMiddleware',\r\n    'django.contrib.auth.middleware.AuthenticationMiddleware',\r\n    'django.contrib.messages.middleware.MessageMiddleware',\r\n    'django.middleware.clickjacking.XFrameOptionsMiddleware',\r\n    'allauth.account.middleware.AccountMiddleware', #\u3053\u306e\u884c\u3092\u8ffd\u52a0\r\n]\r\n<\/code><\/pre>\n<p>\u8fd9\u4e4b\u524d\u4ece\u6765\u6ca1\u6709\u5199\u8fc7\u8fd9\u6837\u7684\u4e1c\u897f&#8230;\u6240\u4ee5\u4ece0.56.0\u7248\u672c\u5f00\u59cb\u9700\u8981\u8fdb\u884c\u8bb0\u5f55\u3002\u518d\u6b21\u6539\u53d8\u7248\u672c\u65f6\u9700\u8981\u6ce8\u610f&#8230;<\/p>\n<p>\u53c2\u8003\u7f51\u7ad9\uff1adjango-allauth\u5b98\u65b9\u6587\u6863<\/p>\n<h1>\u6700\u540e<\/h1>\n<p>\u5728\u8fdb\u884c\u66f4\u65b0\u524d\uff0c\u6a21\u5757\u4f1a\u81ea\u6211\u8b66\u9192\u5e76\u68c0\u67e5\u5b98\u65b9\u6587\u6863\u3002<br \/>\n\u5f53\u5728GitHub\u7b49\u5e73\u53f0\u516c\u5f00\u6e90\u4ee3\u7801\u65f6\uff0c\u8bf7\u52a1\u5fc5\u5728requirements.txt\u4e2d\u4f7f\u7528~=\u7b49\u7b26\u53f7\u6765\u660e\u786e\u7248\u672c\u8bf4\u660e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148 \u5728\u5f00\u53d1\u5e26\u6709\u7528\u6237\u8eab\u4efd\u9a8c\u8bc1\u7684Web\u5e94\u7528\u65f6\u5728Django\u4e2d\u53d1\u751f\u7684\u9519\u8bef\u3002 \u4e3a\u4e86\u6dfb\u52a0\u7528\u6237\u8ba4\u8bc1\u529f\u80fd\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5dj [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-49202","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010django-allauth ver0.56\u3011\u201cNameError: name &#039;allauth&#039; is not defined\u201d\u4e4b\u89e3\u51b3\u65b9\u6cd5 - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u3010django-allauth-ver0-56\u3011nameerror-name-allauth-is-not-defined\u4e4b\u89e3\u51b3\u65b9\u6cd5\u3002\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010django-allauth ver0.56\u3011\u201cNameError: name &#039;allauth&#039; is not defined\u201d\u4e4b\u89e3\u51b3\u65b9\u6cd5\" \/>\n<meta property=\"og:description\" content=\"\u9996\u5148 \u5728\u5f00\u53d1\u5e26\u6709\u7528\u6237\u8eab\u4efd\u9a8c\u8bc1\u7684Web\u5e94\u7528\u65f6\u5728Django\u4e2d\u53d1\u751f\u7684\u9519\u8bef\u3002 \u4e3a\u4e86\u6dfb\u52a0\u7528\u6237\u8ba4\u8bc1\u529f\u80fd\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5dj [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u3010django-allauth-ver0-56\u3011nameerror-name-allauth-is-not-defined\u4e4b\u89e3\u51b3\u65b9\u6cd5\u3002\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-03-07T16:58:41+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-05-04T08:09:22+00:00\" \/>\n<meta name=\"author\" content=\"\u79d1, \u96c5\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u79d1, \u96c5\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90django-allauth-ver0-56%e3%80%91nameerror-name-allauth-is-not-defined%e4%b9%8b%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95%e3%80%82\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90django-allauth-ver0-56%e3%80%91nameerror-name-allauth-is-not-defined%e4%b9%8b%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95%e3%80%82\/\",\"name\":\"\u3010django-allauth ver0.56\u3011\u201cNameError: name 'allauth' is not defined\u201d\u4e4b\u89e3\u51b3\u65b9\u6cd5 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-03-07T16:58:41+00:00\",\"dateModified\":\"2024-05-04T08:09:22+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/41e222757cdd2a3365361328bd79970a\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90django-allauth-ver0-56%e3%80%91nameerror-name-allauth-is-not-defined%e4%b9%8b%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95%e3%80%82\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90django-allauth-ver0-56%e3%80%91nameerror-name-allauth-is-not-defined%e4%b9%8b%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95%e3%80%82\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90django-allauth-ver0-56%e3%80%91nameerror-name-allauth-is-not-defined%e4%b9%8b%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95%e3%80%82\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010django-allauth ver0.56\u3011\u201cNameError: name &#8216;allauth&#8217; is not defined\u201d\u4e4b\u89e3\u51b3\u65b9\u6cd5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/41e222757cdd2a3365361328bd79970a\",\"name\":\"\u79d1, \u96c5\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g\",\"caption\":\"\u79d1, \u96c5\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/keya\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90django-allauth-ver0-56%e3%80%91nameerror-name-allauth-is-not-defined%e4%b9%8b%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95%e3%80%82\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u3010django-allauth ver0.56\u3011\u201cNameError: name 'allauth' is not defined\u201d\u4e4b\u89e3\u51b3\u65b9\u6cd5 - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u3010django-allauth-ver0-56\u3011nameerror-name-allauth-is-not-defined\u4e4b\u89e3\u51b3\u65b9\u6cd5\u3002\/","og_locale":"zh_CN","og_type":"article","og_title":"\u3010django-allauth ver0.56\u3011\u201cNameError: name 'allauth' is not defined\u201d\u4e4b\u89e3\u51b3\u65b9\u6cd5","og_description":"\u9996\u5148 \u5728\u5f00\u53d1\u5e26\u6709\u7528\u6237\u8eab\u4efd\u9a8c\u8bc1\u7684Web\u5e94\u7528\u65f6\u5728Django\u4e2d\u53d1\u751f\u7684\u9519\u8bef\u3002 \u4e3a\u4e86\u6dfb\u52a0\u7528\u6237\u8ba4\u8bc1\u529f\u80fd\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5dj [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u3010django-allauth-ver0-56\u3011nameerror-name-allauth-is-not-defined\u4e4b\u89e3\u51b3\u65b9\u6cd5\u3002\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-03-07T16:58:41+00:00","article_modified_time":"2024-05-04T08:09:22+00:00","author":"\u79d1, \u96c5","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u79d1, \u96c5","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90django-allauth-ver0-56%e3%80%91nameerror-name-allauth-is-not-defined%e4%b9%8b%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95%e3%80%82\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90django-allauth-ver0-56%e3%80%91nameerror-name-allauth-is-not-defined%e4%b9%8b%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95%e3%80%82\/","name":"\u3010django-allauth ver0.56\u3011\u201cNameError: name 'allauth' is not defined\u201d\u4e4b\u89e3\u51b3\u65b9\u6cd5 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-03-07T16:58:41+00:00","dateModified":"2024-05-04T08:09:22+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/41e222757cdd2a3365361328bd79970a"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90django-allauth-ver0-56%e3%80%91nameerror-name-allauth-is-not-defined%e4%b9%8b%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95%e3%80%82\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90django-allauth-ver0-56%e3%80%91nameerror-name-allauth-is-not-defined%e4%b9%8b%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95%e3%80%82\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90django-allauth-ver0-56%e3%80%91nameerror-name-allauth-is-not-defined%e4%b9%8b%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95%e3%80%82\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u3010django-allauth ver0.56\u3011\u201cNameError: name &#8216;allauth&#8217; is not defined\u201d\u4e4b\u89e3\u51b3\u65b9\u6cd5"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/41e222757cdd2a3365361328bd79970a","name":"\u79d1, \u96c5","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g","caption":"\u79d1, \u96c5"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/keya\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90django-allauth-ver0-56%e3%80%91nameerror-name-allauth-is-not-defined%e4%b9%8b%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95%e3%80%82\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/49202","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=49202"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/49202\/revisions"}],"predecessor-version":[{"id":99332,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/49202\/revisions\/99332"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=49202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=49202"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=49202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}