{"id":464188,"date":"2025-06-23T09:00:48","date_gmt":"2025-06-23T09:00:48","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=464188"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=464188","title":{"rendered":"<span>\u041a\u0430\u043a \u0432 2025 \u0433\u043e\u0434\u0443 \u0432 Django \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u0447\u0435\u0440\u0435\u0437 Google<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u044f \u043d\u0430\u0434 Django-\u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c, \u043c\u044b \u0441 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0430\u043c\u0438 <a href=\"https:\/\/t.me\/advanced_python_expert\" rel=\"noopener noreferrer nofollow\"><strong>\u043c\u043e\u0435\u0433\u043e \u043a\u0430\u043d\u0430\u043b\u0430<\/strong><\/a> \u0440\u0435\u0448\u0438\u043b\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432\u0445\u043e\u0434 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0447\u0435\u0440\u0435\u0437 \u044d\u0442\u043e\u0442 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0438 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434, \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442, \u0438 \u043d\u0443\u0436\u043d\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c. \u041e\u043d \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n<h3>\u0412\u042b\u041f\u041e\u041b\u041d\u042f\u0415\u041c \u0423\u0421\u0422\u0410\u041d\u041e\u0412\u041a\u0423 \u0411\u0418\u0411\u041b\u0418\u041e\u0422\u0415\u041a\u0418 \u0410\u0423\u0422\u0415\u041d\u0422\u0418\u0424\u0418\u041a\u0410\u0426\u0418\u0418 \u0418 \u041d\u0410\u0421\u0422\u0420\u041e\u0419\u041a\u0423 \u041f\u0420\u041e\u0415\u041a\u0422\u0410<\/h3>\n<p>\u0410\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0431\u0430\u0437\u0435 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 OAuth 2.0, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 Python Social Auth Django.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <strong>social-auth-core<\/strong> \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <strong>social-auth-app-django <\/strong>\u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438\/\u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0432 Django. \u041e\u0431\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u043c\u044b \u0443\u043a\u0430\u0437\u0430\u043b\u0438 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 \u0444\u0430\u0439\u043b\u0435 <strong>requirements.txt<\/strong>:<\/p>\n<pre><code>social-auth-app-django==5.0.0 social-auth-core==4.1.0<\/code><\/pre>\n<p>\u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u043c \u043f\u0443\u0442\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0438\u0437 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430 \u0432 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code>pip install -r requirements.txt<\/code><\/pre>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u0447\u0435\u0440\u0435\u0449 \u043c\u043e\u0434\u0443\u043b\u044c <strong>settings.py:<\/strong>    <\/p>\n<pre><code>INSTALLED_APPS = [     \u2026     'social_django', ]<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438:<\/p>\n<pre><code>python manage.py migrate<\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:    <\/p>\n<figure class=\"bordered full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/959\/49f\/ecb\/95949fecb1698cc982c7c4d3c55aa87e.png\" width=\"603\" height=\"238\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/959\/49f\/ecb\/95949fecb1698cc982c7c4d3c55aa87e.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/959\/49f\/ecb\/95949fecb1698cc982c7c4d3c55aa87e.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0415\u0441\u043b\u0438 \u0443\u0447\u0435\u0442\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 \u0443 \u0432\u0430\u0441 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0430\u0434\u043c\u0438\u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 (\u0443\u043a\u0430\u0437\u0430\u0432 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043b\u043e\u0433\u0438\u043d\u0430 \u0438 \u043f\u0430\u0440\u043e\u043b\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0442\u0440\u043e\u043a\u0443 <em>admin<\/em>):<\/p>\n<pre><code>python manage.py createsuperuser<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0431\u044d\u043a\u0435\u043d\u0434\u044b \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u043c\u043e\u0434\u0443\u043b\u044c <strong>settings.py<\/strong> \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443 \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c:<\/p>\n<pre><code>AUTHENTICATION_BACKENDS = (     'social_core.backends.google.GoogleOAuth2',     'django.contrib.auth.backends.ModelBackend', )<\/code><\/pre>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440:    <\/p>\n<pre><code>'social_core.backends.google.GoogleOAuth2'<\/code><\/pre>\n<p>\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0431\u044d\u043a\u0435\u043d\u0434\u0443 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c Google.<\/p>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440:    <\/p>\n<pre><code>'django.contrib.auth.backends.ModelBackend',<\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0431\u044d\u043a\u0435\u043d\u0434 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0439 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c.    <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c, \u0438\u043d\u0430\u0447\u0435 \u0438\u0441\u0447\u0435\u0437\u043d\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u0445\u043e\u0434\u0430 \u043f\u043e \u043b\u043e\u0433\u0438\u043d\u0443 \u0438 \u043f\u0430\u0440\u043e\u043b\u044e.    <\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 <strong>settings.py<\/strong>:<\/p>\n<pre><code>TEMPLATES = [     {      \u2026         'OPTIONS': {             'context_processors': [             \u2026                                         'social_django.context_processors.backends',         'social_django.context_processors.login_redirect',             ],         },     }, ]<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0434\u043b\u044f \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043c\u043e\u0434\u0443\u043b\u044c <strong>urls.py<\/strong> \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0442\u0430\u043a\u0443\u044e \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0443:<\/p>\n<pre><code>urlpatterns = [     \u2026     path('oauth\/', include('social_django.urls', namespace='social')), ]<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043c\u043e\u0434\u0443\u043b\u044c <strong>settings.py<\/strong> \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b:<\/p>\n<pre><code>SOCIAL_AUTH_URL_NAMESPACE = 'social' LOGIN_REDIRECT_URL = '\/'<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u0434\u043b\u044f \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 Google.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u0448\u0430\u0431\u043b\u043e\u043d <strong>login.html<\/strong> \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f <strong>authapp<\/strong>:<\/p>\n<pre><code>&lt;button class=\"btn btn-round form-control\"&gt;     &lt;a href=\"{% url 'social:begin' 'google-oauth2' %}\"&gt;         \u0412\u0445\u043e\u0434 \u0447\u0435\u0440\u0435\u0437 Google     &lt;\/a&gt; &lt;\/button&gt;<\/code><\/pre>\n<h2>\u0412\u042b\u041f\u041e\u041b\u041d\u042f\u0415\u041c \u041d\u0410\u0421\u0422\u0420\u041e\u0419\u041a\u0423 \u041a\u041b\u042e\u0427\u0410 \u0418 \u0421\u0415\u041a\u0420\u0415\u0422\u0410 \u0414\u041b\u042f \u0410\u0423\u0422\u0415\u041d\u0422\u0418\u0424\u0418\u041a\u0410\u0426\u0418\u0418    <\/h2>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043f\u043e <a href=\"https:\/\/console.cloud.google.com\/projectcreate\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0435 <\/a>\u0438 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435:<\/p>\n<figure class=\"bordered full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8d4\/0b9\/d1f\/8d40b9d1fef6293b42e25c5175cd49d7.png\" width=\"555\" height=\"340\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/8d4\/0b9\/d1f\/8d40b9d1fef6293b42e25c5175cd49d7.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8d4\/0b9\/d1f\/8d40b9d1fef6293b42e25c5175cd49d7.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<div class=\"floating-image\">\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043f\u043e <a href=\"https:\/\/console.cloud.google.com\/apis\/credentials\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a> \u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 OAuth:    <\/p>\n<\/div>\n<figure class=\"bordered full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4d4\/128\/460\/4d4128460204ada1bab2298b5d183a92.png\" width=\"708\" height=\"369\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/4d4\/128\/460\/4d4128460204ada1bab2298b5d183a92.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4d4\/128\/460\/4d4128460204ada1bab2298b5d183a92.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c CONFIGURE CONSENT SCREEN:    <\/p>\n<figure class=\"bordered\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8dd\/1f6\/322\/8dd1f63229bd8a0bbee6f8a8f1d8316b.png\" width=\"346\" height=\"169\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/8dd\/1f6\/322\/8dd1f63229bd8a0bbee6f8a8f1d8316b.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8dd\/1f6\/322\/8dd1f63229bd8a0bbee6f8a8f1d8316b.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c Get Started:    <\/p>\n<figure class=\"bordered\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/45c\/004\/162\/45c0041623bbe422acb6794a1853be9b.png\" width=\"499\" height=\"397\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/45c\/004\/162\/45c0041623bbe422acb6794a1853be9b.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/45c\/004\/162\/45c0041623bbe422acb6794a1853be9b.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0412\u0432\u043e\u0434\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u0447\u0442\u0443:    <\/p>\n<figure class=\"bordered full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/73d\/ace\/9d5\/73dace9d5e9cd3d2d4caebf488f0c11b.png\" width=\"569\" height=\"263\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/73d\/ace\/9d5\/73dace9d5e9cd3d2d4caebf488f0c11b.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/73d\/ace\/9d5\/73dace9d5e9cd3d2d4caebf488f0c11b.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c External \u0438 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u043c:    <\/p>\n<figure class=\"bordered full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6c3\/af0\/32a\/6c3af032aa9c907a85fab1ce53c46679.png\" width=\"549\" height=\"513\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/6c3\/af0\/32a\/6c3af032aa9c907a85fab1ce53c46679.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6c3\/af0\/32a\/6c3af032aa9c907a85fab1ce53c46679.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432\u043d\u043e\u0432\u044c \u0432 \u0440\u0430\u0437\u0434\u0435\u043b Credentials:    <\/p>\n<figure class=\"bordered\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/263\/8a9\/8fc\/2638a98fcd339db54bb241aa77a7afa6.png\" width=\"468\" height=\"470\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/263\/8a9\/8fc\/2638a98fcd339db54bb241aa77a7afa6.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/263\/8a9\/8fc\/2638a98fcd339db54bb241aa77a7afa6.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f:    <\/p>\n<figure class=\"bordered full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5bb\/dcd\/c0e\/5bbdcdc0e70d17db4840204503c8d200.png\" width=\"632\" height=\"317\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/5bb\/dcd\/c0e\/5bbdcdc0e70d17db4840204503c8d200.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5bb\/dcd\/c0e\/5bbdcdc0e70d17db4840204503c8d200.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0432\u0435\u0431 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0438\u043c\u044f \u0438 \u0430\u0434\u0440\u0435\u0441 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f <a href=\"http:\/\/127.0.0.1:8000\/oauth\/complete\/google-oauth2\/\" rel=\"noopener noreferrer nofollow\">http:\/\/127.0.0.1:8000\/oauth\/complete\/google-oauth2\/<\/a>:    <\/p>\n<figure class=\"bordered full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5e2\/01b\/cec\/5e201bcec22f32da20e30f697e44009b.png\" width=\"536\" height=\"688\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/5e2\/01b\/cec\/5e201bcec22f32da20e30f697e44009b.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5e2\/01b\/cec\/5e201bcec22f32da20e30f697e44009b.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u043a\u043b\u044e\u0447 \u0438 \u0441\u0435\u043a\u0440\u0435\u0442:    <\/p>\n<figure class=\"bordered\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1e3\/208\/042\/1e320804297f7a28210fe6bee2196bb6.png\" width=\"480\" height=\"550\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/1e3\/208\/042\/1e320804297f7a28210fe6bee2196bb6.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1e3\/208\/042\/1e320804297f7a28210fe6bee2196bb6.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0418 \u0443\u043a\u0430\u0436\u0435\u043c \u0438\u0445 \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 <strong>settings.py<\/strong>:    <\/p>\n<pre><code>SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = '847071034656-qeeuus2sh5u6qs3vtodvven2u9pq2c36.apps.googleusercontent.com'  SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = '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'<\/code><\/pre>\n<h2>\u0412\u042b\u041f\u041e\u041b\u041d\u042f\u0415\u041c \u0417\u0410\u041f\u0423\u0421\u041a    <\/h2>\n<p>\u0415\u0441\u043b\u0438 \u0441\u0435\u0439\u0447\u0430\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0443\u0441\u043a \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430:    <\/p>\n<pre><code>python manage.py runserver<\/code><\/pre>\n<p>\u0418 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0430 \u0444\u043e\u0440\u043c\u0435 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u043e\u0432\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443.    <\/p>\n<figure class=\"bordered\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c15\/dc2\/283\/c15dc22837836096ed0a5f7ee91a8302.png\" width=\"517\" height=\"443\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/c15\/dc2\/283\/c15dc22837836096ed0a5f7ee91a8302.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c15\/dc2\/283\/c15dc22837836096ed0a5f7ee91a8302.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0432\u0445\u043e\u0434 \u0447\u0435\u0440\u0435\u0437 Google.<\/p>\n<p><strong>P.S.<\/strong> \u042f \u0441\u043e\u0437\u0434\u0430\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 Django-\u043f\u0440\u043e\u0435\u043a\u0442, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430. \u0421\u043a\u0430\u0447\u0430\u0442\u044c \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/drive.google.com\/file\/d\/1ktf5GySXa3vhZ8o7tAWea8VJvX9SHvnO\/view?usp=sharing\" rel=\"noopener noreferrer nofollow\"><strong>\u0437\u0434\u0435\u0441\u044c<\/strong><\/a>, \u043d\u043e \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0444\u0430\u0439\u043b <strong>readme<\/strong> \u0434\u043b\u044f \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a. \u0423\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0447\u0435\u0440\u0435\u0437 Google! \u0410 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0444\u0438\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 Django-\u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 Google.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/920868\/\"> https:\/\/habr.com\/ru\/articles\/920868\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u044f \u043d\u0430\u0434 Django-\u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c, \u043c\u044b \u0441 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0430\u043c\u0438 <a href=\"https:\/\/t.me\/advanced_python_expert\" rel=\"noopener noreferrer nofollow\"><strong>\u043c\u043e\u0435\u0433\u043e \u043a\u0430\u043d\u0430\u043b\u0430<\/strong><\/a> \u0440\u0435\u0448\u0438\u043b\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432\u0445\u043e\u0434 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0447\u0435\u0440\u0435\u0437 \u044d\u0442\u043e\u0442 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0438 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434, \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442, \u0438 \u043d\u0443\u0436\u043d\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c. \u041e\u043d \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n<h3>\u0412\u042b\u041f\u041e\u041b\u041d\u042f\u0415\u041c \u0423\u0421\u0422\u0410\u041d\u041e\u0412\u041a\u0423 \u0411\u0418\u0411\u041b\u0418\u041e\u0422\u0415\u041a\u0418 \u0410\u0423\u0422\u0415\u041d\u0422\u0418\u0424\u0418\u041a\u0410\u0426\u0418\u0418 \u0418 \u041d\u0410\u0421\u0422\u0420\u041e\u0419\u041a\u0423 \u041f\u0420\u041e\u0415\u041a\u0422\u0410<\/h3>\n<p>\u0410\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0431\u0430\u0437\u0435 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 OAuth 2.0, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 Python Social Auth Django.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <strong>social-auth-core<\/strong> \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <strong>social-auth-app-django <\/strong>\u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438\/\u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0432 Django. \u041e\u0431\u0430 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u043c\u044b \u0443\u043a\u0430\u0437\u0430\u043b\u0438 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 \u0444\u0430\u0439\u043b\u0435 <strong>requirements.txt<\/strong>:<\/p>\n<pre><code>social-auth-app-django==5.0.0 social-auth-core==4.1.0<\/code><\/pre>\n<p>\u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u043c \u043f\u0443\u0442\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0438\u0437 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430 \u0432 \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code>pip install -r requirements.txt<\/code><\/pre>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u0447\u0435\u0440\u0435\u0449 \u043c\u043e\u0434\u0443\u043b\u044c <strong>settings.py:<\/strong>    <\/p>\n<pre><code>INSTALLED_APPS = [     \u2026     'social_django', ]<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438:<\/p>\n<pre><code>python manage.py migrate<\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:    <\/p>\n<figure class=\"bordered full-width\"><\/figure>\n<p>\u0415\u0441\u043b\u0438 \u0443\u0447\u0435\u0442\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 \u0443 \u0432\u0430\u0441 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0430\u0434\u043c\u0438\u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 (\u0443\u043a\u0430\u0437\u0430\u0432 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043b\u043e\u0433\u0438\u043d\u0430 \u0438 \u043f\u0430\u0440\u043e\u043b\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0442\u0440\u043e\u043a\u0443 <em>admin<\/em>):<\/p>\n<pre><code>python manage.py createsuperuser<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0431\u044d\u043a\u0435\u043d\u0434\u044b \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u043c\u043e\u0434\u0443\u043b\u044c <strong>settings.py<\/strong> \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443 \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c:<\/p>\n<pre><code>AUTHENTICATION_BACKENDS = (     'social_core.backends.google.GoogleOAuth2',     'django.contrib.auth.backends.ModelBackend', )<\/code><\/pre>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440:    <\/p>\n<pre><code>'social_core.backends.google.GoogleOAuth2'<\/code><\/pre>\n<p>\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0431\u044d\u043a\u0435\u043d\u0434\u0443 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c Google.<\/p>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440:    <\/p>\n<pre><code>'django.contrib.auth.backends.ModelBackend',<\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0431\u044d\u043a\u0435\u043d\u0434 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0439 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c.    <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c, \u0438\u043d\u0430\u0447\u0435 \u0438\u0441\u0447\u0435\u0437\u043d\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u0445\u043e\u0434\u0430 \u043f\u043e \u043b\u043e\u0433\u0438\u043d\u0443 \u0438 \u043f\u0430\u0440\u043e\u043b\u044e.    <\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 <strong>settings.py<\/strong>:<\/p>\n<pre><code>TEMPLATES = [     {      \u2026         'OPTIONS': {             'context_processors': [             \u2026                                         'social_django.context_processors.backends',         'social_django.context_processors.login_redirect',             ],         },     }, ]<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0434\u043b\u044f \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043c\u043e\u0434\u0443\u043b\u044c <strong>urls.py<\/strong> \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0442\u0430\u043a\u0443\u044e \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0443:<\/p>\n<pre><code>urlpatterns = [     \u2026     path('oauth\/', include('social_django.urls', namespace='social')), ]<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043c\u043e\u0434\u0443\u043b\u044c <strong>settings.py<\/strong> \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b:<\/p>\n<pre><code>SOCIAL_AUTH_URL_NAMESPACE = 'social' LOGIN_REDIRECT_URL = '\/'<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u0434\u043b\u044f \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 Google.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u0448\u0430\u0431\u043b\u043e\u043d <strong>login.html<\/strong> \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f <strong>authapp<\/strong>:<\/p>\n<pre><code>&lt;button class=\"btn btn-round form-control\"&gt;     &lt;a href=\"{% url 'social:begin' 'google-oauth2' %}\"&gt;         \u0412\u0445\u043e\u0434 \u0447\u0435\u0440\u0435\u0437 Google     &lt;\/a&gt; &lt;\/button&gt;<\/code><\/pre>\n<h2>\u0412\u042b\u041f\u041e\u041b\u041d\u042f\u0415\u041c \u041d\u0410\u0421\u0422\u0420\u041e\u0419\u041a\u0423 \u041a\u041b\u042e\u0427\u0410 \u0418 \u0421\u0415\u041a\u0420\u0415\u0422\u0410 \u0414\u041b\u042f \u0410\u0423\u0422\u0415\u041d\u0422\u0418\u0424\u0418\u041a\u0410\u0426\u0418\u0418    <\/h2>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043f\u043e <a href=\"https:\/\/console.cloud.google.com\/projectcreate\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0435 <\/a>\u0438 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435:<\/p>\n<figure class=\"bordered full-width\"><\/figure>\n<div class=\"floating-image\">\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043f\u043e <a href=\"https:\/\/console.cloud.google.com\/apis\/credentials\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a> \u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 OAuth:    <\/p>\n<\/div>\n<figure class=\"bordered full-width\"><\/figure>\n<p>\u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c CONFIGURE CONSENT SCREEN:    <\/p>\n<figure class=\"bordered\"><\/figure>\n<p>\u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c Get Started:    <\/p>\n<figure class=\"bordered\"><\/figure>\n<p>\u0412\u0432\u043e\u0434\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u0447\u0442\u0443:    <\/p>\n<figure class=\"bordered full-width\"><\/figure>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c External \u0438 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u043c:    <\/p>\n<figure class=\"bordered full-width\"><\/figure>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432\u043d\u043e\u0432\u044c \u0432 \u0440\u0430\u0437\u0434\u0435\u043b Credentials:    <\/p>\n<figure class=\"bordered\"><\/figure>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f:    <\/p>\n<figure class=\"bordered full-width\"><\/figure>\n<p>\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0432\u0435\u0431 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0438\u043c\u044f \u0438 \u0430\u0434\u0440\u0435\u0441 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f <a href=\"http:\/\/127.0.0.1:8000\/oauth\/complete\/google-oauth2\/\" rel=\"noopener noreferrer nofollow\">http:\/\/127.0.0.1:8000\/oauth\/complete\/google-oauth2\/<\/a>:    <\/p>\n<figure class=\"bordered full-width\"><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u043a\u043b\u044e\u0447 \u0438 \u0441\u0435\u043a\u0440\u0435\u0442:    <\/p>\n<figure class=\"bordered\"><\/figure>\n<p>\u0418 \u0443\u043a\u0430\u0436\u0435\u043c \u0438\u0445 \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 <strong>settings.py<\/strong>:    <\/p>\n<pre><code>SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = '847071034656-qeeuus2sh5u6qs3vtodvven2u9pq2c36.apps.googleusercontent.com'  SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = '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'<\/code><\/pre>\n<h2>\u0412\u042b\u041f\u041e\u041b\u041d\u042f\u0415\u041c \u0417\u0410\u041f\u0423\u0421\u041a    <\/h2>\n<p>\u0415\u0441\u043b\u0438 \u0441\u0435\u0439\u0447\u0430\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0443\u0441\u043a \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430:    <\/p>\n<pre><code>python manage.py runserver<\/code><\/pre>\n<p>\u0418 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0430 \u0444\u043e\u0440\u043c\u0435 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u043e\u0432\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443.    <\/p>\n<figure class=\"bordered\"><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0432\u0445\u043e\u0434 \u0447\u0435\u0440\u0435\u0437 Google.<\/p>\n<p><strong>P.S.<\/strong> \u042f \u0441\u043e\u0437\u0434\u0430\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 Django-\u043f\u0440\u043e\u0435\u043a\u0442, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430. \u0421\u043a\u0430\u0447\u0430\u0442\u044c \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/drive.google.com\/file\/d\/1ktf5GySXa3vhZ8o7tAWea8VJvX9SHvnO\/view?usp=sharing\" rel=\"noopener noreferrer nofollow\"><strong>\u0437\u0434\u0435\u0441\u044c<\/strong><\/a>, \u043d\u043e \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0444\u0430\u0439\u043b <strong>readme<\/strong> \u0434\u043b\u044f \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a. \u0423\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0447\u0435\u0440\u0435\u0437 Google! \u0410 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0444\u0438\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 Django-\u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 Google.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/920868\/\"> https:\/\/habr.com\/ru\/articles\/920868\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-464188","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/464188","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=464188"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/464188\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=464188"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=464188"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=464188"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}