[QRTR-76] User creation added.
This commit is contained in:
parent
502383771f
commit
08ac278a9a
@ -43,11 +43,8 @@ INSTALLED_APPS = [
|
||||
'django.contrib.staticfiles',
|
||||
'rest_framework',
|
||||
'rest_framework.authtoken',
|
||||
'rest_auth',
|
||||
'dj_rest_auth',
|
||||
'django.contrib.sites',
|
||||
'allauth',
|
||||
'allauth.account',
|
||||
'rest_auth.registration',
|
||||
'api',
|
||||
'user',
|
||||
'connection',
|
||||
|
||||
137
core/settings/__init__.py
Normal file
137
core/settings/__init__.py
Normal file
@ -0,0 +1,137 @@
|
||||
"""
|
||||
Django settings for qrtr_services project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 2.2.6.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/2.2/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/2.2/ref/settings/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
try:
|
||||
from .local import *
|
||||
except ImportError:
|
||||
print("Loading Production Environment!")
|
||||
from .production import *
|
||||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'rest_framework',
|
||||
'rest_framework.authtoken',
|
||||
'dj_rest_auth',
|
||||
'allauth',
|
||||
'allauth.account',
|
||||
'allauth.socialaccount',
|
||||
'dj_rest_auth.registration',
|
||||
'allauth.socialaccount.providers.facebook',
|
||||
'allauth.socialaccount.providers.twitter',
|
||||
'django.contrib.sites',
|
||||
'api',
|
||||
'user',
|
||||
'connection',
|
||||
'qrtr_account',
|
||||
'corsheaders',
|
||||
]
|
||||
|
||||
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||
|
||||
SITE_ID = 1
|
||||
|
||||
|
||||
MIDDLEWARE = [
|
||||
'corsheaders.middleware.CorsMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
'whitenoise.middleware.WhiteNoiseMiddleware',
|
||||
]
|
||||
|
||||
CORS_ORIGIN_WHITELIST = [
|
||||
'http://localhost:3000',
|
||||
'https://localhost:3000'
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'core.urls'
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
'django.template.context_processors.debug',
|
||||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'core.wsgi.application'
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
|
||||
|
||||
|
||||
|
||||
AUTH_USER_MODEL = 'user.User'
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
|
||||
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/2.2/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
USE_L10N = True
|
||||
|
||||
USE_TZ = False
|
||||
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/2.2/howto/static-files/
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
18
core/settings/local.py
Normal file
18
core/settings/local.py
Normal file
@ -0,0 +1,18 @@
|
||||
import os
|
||||
import dj_database_url
|
||||
|
||||
|
||||
DEFAULT_CONNECTION = dj_database_url.parse('postgres://djg:1774274aB@localhost:5432/qrtr-local')
|
||||
|
||||
DATABASES = {"default": DEFAULT_CONNECTION, }
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'jc@r$_x4$mp-b84&+m3s@hm7kpl$br-wa&50*&xjx^^fddg6q$'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = ['*']
|
||||
10
core/urls.py
10
core/urls.py
@ -25,7 +25,9 @@ from qrtr_account.views import (AccountViewSet,
|
||||
TransactionViewSet,
|
||||
SliceViewSet,
|
||||
ConnectionViewSet,
|
||||
ConnectionTypeViewSet)
|
||||
ConnectionTypeViewSet,
|
||||
FacebookLogin,
|
||||
TwitterLogin)
|
||||
|
||||
|
||||
router = routers.DefaultRouter()
|
||||
@ -44,8 +46,10 @@ router.register(r'connectiontypes',ConnectionTypeViewSet)
|
||||
|
||||
apipatterns = [
|
||||
path('', include(router.urls)),
|
||||
path('auth/', include('rest_framework.urls', namespace='rest_framework'), name='auth'),
|
||||
path('auth/registration/', include('rest_auth.registration.urls'), name='register'),
|
||||
path('auth/', include('dj_rest_auth.urls'), name='auth'),
|
||||
path('auth/registration/', include('dj_rest_auth.registration.urls')),
|
||||
path('auth/facebook/', FacebookLogin.as_view(), name='fb_login'),
|
||||
path('auth/twitter/', TwitterLogin.as_view(), name='twitter_login'),
|
||||
path('connection/', include('connection.urls'), name='Connection Settings'),
|
||||
]
|
||||
|
||||
|
||||
@ -10,6 +10,19 @@ from api.serializers import (AccountSerializer,
|
||||
ConnectionTypeSerializer,
|
||||
SliceSerializer,
|
||||
RuleSerializer)
|
||||
from allauth.socialaccount.providers.facebook.views import FacebookOAuth2Adapter
|
||||
from dj_rest_auth.registration.views import SocialLoginView
|
||||
from allauth.socialaccount.providers.twitter.views import TwitterOAuthAdapter
|
||||
from dj_rest_auth.social_serializers import TwitterLoginSerializer
|
||||
|
||||
|
||||
class TwitterLogin(SocialLoginView):
|
||||
serializer_class = TwitterLoginSerializer
|
||||
adapter_class = TwitterOAuthAdapter
|
||||
|
||||
|
||||
class FacebookLogin(SocialLoginView):
|
||||
adapter_class = FacebookOAuth2Adapter
|
||||
|
||||
|
||||
class AccountViewSet(viewsets.ModelViewSet):
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
Django>=3.0.5
|
||||
django-allauth>=0.40.0
|
||||
django-cors-headers>=3.2.0
|
||||
django-genericrelationview>=0.1.1
|
||||
django-jsonfield>=1.3.1
|
||||
django-rest-auth>=0.9.5
|
||||
django-rest-framework>=0.1.0
|
||||
djangorestframework>=3.10.3
|
||||
dj-rest-auth>=1.1.0
|
||||
ipykernel>=5.1.2
|
||||
ipython>=5.8.0
|
||||
plaid-python>=3.7.0
|
||||
|
||||
Loading…
Reference in New Issue
Block a user