Added accounts

This commit is contained in:
keannu125 2023-02-28 22:16:45 +08:00
parent 9dfdc4aa2f
commit dab99b17cf
12 changed files with 47 additions and 4 deletions

View file

@ -7,6 +7,7 @@ name = "pypi"
django = "*" django = "*"
djangorestframework = "*" djangorestframework = "*"
djoser = "*" djoser = "*"
djangorestframework-simplejwt = "*"
[dev-packages] [dev-packages]
autopep8 = "*" autopep8 = "*"

4
Pipfile.lock generated
View file

@ -1,7 +1,7 @@
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "61283271cb703ae19a49d5f7e87bf45e11f8f8528f976137f957d2912347dceb" "sha256": "309b0b7b7b2f3dce9f8501a57dac5257ba3cca7d8e01cfc7284aa6c48279b23b"
}, },
"pipfile-spec": 6, "pipfile-spec": 6,
"requires": { "requires": {
@ -273,7 +273,7 @@
"sha256:153c973c5c154baf566be431de8527c2bd62557fde7373ebcb0f02b73b28e07a", "sha256:153c973c5c154baf566be431de8527c2bd62557fde7373ebcb0f02b73b28e07a",
"sha256:6f09f97cb015265e85d1d02dc6bfc299c72c231eecbe261c5bee5c6b2867f2b4" "sha256:6f09f97cb015265e85d1d02dc6bfc299c72c231eecbe261c5bee5c6b2867f2b4"
], ],
"markers": "python_version >= '3.7'", "index": "pypi",
"version": "==4.8.0" "version": "==4.8.0"
}, },
"djoser": { "djoser": {

0
ivy/accounts/__init__.py Normal file
View file

3
ivy/accounts/admin.py Normal file
View file

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

6
ivy/accounts/apps.py Normal file
View file

@ -0,0 +1,6 @@
from django.apps import AppConfig
class AccountsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'accounts'

View file

3
ivy/accounts/models.py Normal file
View file

@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

3
ivy/accounts/tests.py Normal file
View file

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

7
ivy/accounts/urls.py Normal file
View file

@ -0,0 +1,7 @@
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('', include('djoser.urls')),
path('', include('djoser.urls.authtoken'))
]

3
ivy/accounts/views.py Normal file
View file

@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.

View file

@ -2,5 +2,5 @@ from django.contrib import admin
from django.urls import path, include from django.urls import path, include
urlpatterns = [ urlpatterns = [
path('', include('djoser.urls')) path('accounts/', include('accounts.urls'))
] ]

View file

@ -38,8 +38,8 @@ INSTALLED_APPS = [
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'rest_framework', 'rest_framework',
'rest_framework.authtoken',
'djoser', 'djoser',
'api',
] ]
MIDDLEWARE = [ MIDDLEWARE = [
@ -124,3 +124,20 @@ STATIC_URL = 'static/'
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field # https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.TokenAuthentication',
)
}
DJOSER = {
'SEND_ACTIVATION_EMAIL': True,
'SEND_CONFIRMATION_EMAIL': True,
'ACTIVATION_URL': 'activation/{uid}/{token}',
}
EMAIL_HOST = 'sandbox.smtp.mailtrap.io'
EMAIL_HOST_USER = '54ff6949e39105'
EMAIL_HOST_PASSWORD = 'c59d3eaa05f98d'
EMAIL_PORT = '2525'