Skip to content

Commit 03dd97b

Browse files
committed
'add_api_user_authentication'
1 parent bd2832a commit 03dd97b

File tree

6 files changed

+196
-4
lines changed

6 files changed

+196
-4
lines changed

Diff for: Pipfile

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ name = "pypi"
77
django = "*"
88
djangorestframework = "*"
99
psycopg2-binary = "*"
10+
django-rest-auth = "*"
11+
django-allauth = "*"
1012

1113
[dev-packages]
1214
mypy = "*"

Diff for: Pipfile.lock

+174-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: blogapi/__pycache__/settings.cpython-39.pyc

369 Bytes
Binary file not shown.

Diff for: blogapi/__pycache__/urls.cpython-39.pyc

124 Bytes
Binary file not shown.

Diff for: blogapi/settings.py

+18
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,18 @@
3737
'django.contrib.sessions',
3838
'django.contrib.messages',
3939
'django.contrib.staticfiles',
40+
'django.contrib.sites',
4041

4142
# third-party
4243
'rest_framework',
44+
'rest_framework.authtoken',
45+
46+
'rest_auth',
47+
'rest_auth.registration',
48+
49+
'allauth',
50+
'allauth.account',
51+
'allauth.socialaccount',
4352

4453
# local
4554
'posts.apps.PostsConfig',
@@ -49,8 +58,17 @@
4958
REST_FRAMEWORK = {
5059
'DEFAULT_PERMISSION_CLASSES':[
5160
'rest_framework.permissions.IsAuthenticated',
61+
],
62+
'DEFAULT_AUTHENTICATION_CLASSES':[
63+
'rest_framework.authentication.SessionAuthentication',
64+
'rest_framework.authentication.TokenAuthentication',
5265
]
5366
}
67+
68+
# Alluth settings
69+
SITE_ID = 1
70+
71+
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
5472
MIDDLEWARE = [
5573
'django.middleware.security.SecurityMiddleware',
5674
'django.contrib.sessions.middleware.SessionMiddleware',

Diff for: blogapi/urls.py

+2
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@
2020
path('admin/', admin.site.urls),
2121
path('api/v1/', include('posts.urls')),
2222
path('api-auth/', include('rest_framework.urls')),
23+
path('api/v1/rest-auth/', include('rest_auth.urls')),
24+
path('api/v1/rest-auth/registration/', include('rest_auth.registration.urls')),
2325
]

0 commit comments

Comments
 (0)