|
| 1 | +""" |
| 2 | +Django settings for parserx project. |
| 3 | +
|
| 4 | +Generated by 'django-admin startproject' using Django 3.0.6. |
| 5 | +
|
| 6 | +For more information on this file, see |
| 7 | +https://docs.djangoproject.com/en/3.0/topics/settings/ |
| 8 | +
|
| 9 | +For the full list of settings and their values, see |
| 10 | +https://docs.djangoproject.com/en/3.0/ref/settings/ |
| 11 | +""" |
| 12 | + |
| 13 | +import os |
| 14 | + |
| 15 | +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) |
| 16 | +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
| 17 | + |
| 18 | + |
| 19 | +# Quick-start development settings - unsuitable for production |
| 20 | +# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ |
| 21 | + |
| 22 | +# SECURITY WARNING: keep the secret key used in production secret! |
| 23 | +SECRET_KEY = '6)yv)a&b#q%j03b_pp7j=5&vs4et4hwlvv+tob#e_&ytro*ng' |
| 24 | + |
| 25 | +# SECURITY WARNING: don't run with debug turned on in production! |
| 26 | +DEBUG = True |
| 27 | + |
| 28 | +ALLOWED_HOSTS = ['localhost'] |
| 29 | + |
| 30 | +CSRF_TRUSTED_ORIGINS=['https://api.parserx.io'] |
| 31 | + |
| 32 | +EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" |
| 33 | + |
| 34 | +# Application definition |
| 35 | + |
| 36 | +INSTALLED_APPS = [ |
| 37 | + 'django.contrib.admin', |
| 38 | + 'django.contrib.auth', |
| 39 | + 'django.contrib.contenttypes', |
| 40 | + 'django.contrib.sessions', |
| 41 | + 'django.contrib.messages', |
| 42 | + 'django.contrib.staticfiles', |
| 43 | + # REST |
| 44 | + 'rest_framework', |
| 45 | + 'rest_framework.authtoken', |
| 46 | + 'rest_framework_api_key', |
| 47 | + # third party |
| 48 | + 'corsheaders', |
| 49 | + 'djoser', |
| 50 | + # local |
| 51 | + 'sig.apps.SigConfig', |
| 52 | +] |
| 53 | + |
| 54 | +MIDDLEWARE = [ |
| 55 | + 'django.middleware.security.SecurityMiddleware', |
| 56 | + 'django.contrib.sessions.middleware.SessionMiddleware', |
| 57 | + 'django.middleware.common.CommonMiddleware', |
| 58 | + 'django.middleware.csrf.CsrfViewMiddleware', |
| 59 | + 'django.contrib.auth.middleware.AuthenticationMiddleware', |
| 60 | + 'django.contrib.messages.middleware.MessageMiddleware', |
| 61 | + 'django.middleware.clickjacking.XFrameOptionsMiddleware', |
| 62 | + # third party |
| 63 | + 'corsheaders.middleware.CorsMiddleware', |
| 64 | +] |
| 65 | + |
| 66 | +CORS_ORIGIN_ALLOW_ALL = True |
| 67 | +""" |
| 68 | +CORS_ORIGIN_ALLOW_ALL = False |
| 69 | +CORS_ORIGIN_WHITELIST = ( |
| 70 | + 'http://localhost:4200', |
| 71 | +) |
| 72 | +""" |
| 73 | + |
| 74 | +ROOT_URLCONF = 'parserx.urls' |
| 75 | + |
| 76 | +DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' |
| 77 | + |
| 78 | +TEMPLATES = [ |
| 79 | + { |
| 80 | + 'BACKEND': 'django.template.backends.django.DjangoTemplates', |
| 81 | + 'DIRS': [], |
| 82 | + 'APP_DIRS': True, |
| 83 | + 'OPTIONS': { |
| 84 | + 'context_processors': [ |
| 85 | + 'django.template.context_processors.debug', |
| 86 | + 'django.template.context_processors.request', |
| 87 | + 'django.contrib.auth.context_processors.auth', |
| 88 | + 'django.contrib.messages.context_processors.messages', |
| 89 | + ], |
| 90 | + }, |
| 91 | + }, |
| 92 | +] |
| 93 | + |
| 94 | +WSGI_APPLICATION = 'parserx.wsgi.application' |
| 95 | + |
| 96 | + |
| 97 | +# Database |
| 98 | +# https://docs.djangoproject.com/en/3.0/ref/settings/#databases |
| 99 | + |
| 100 | +DATABASES = { |
| 101 | + 'default': { |
| 102 | + 'ENGINE': 'django.db.backends.mysql', |
| 103 | + 'NAME': 'parserx', |
| 104 | + 'USER': 'parserx', |
| 105 | + 'PASSWORD': 'password', |
| 106 | + } |
| 107 | +} |
| 108 | + |
| 109 | +# REST framework |
| 110 | +REST_FRAMEWORK = { |
| 111 | + 'DEFAULT_AUTHENTICATION_CLASSES': ( |
| 112 | + 'rest_framework.authentication.TokenAuthentication', |
| 113 | + ), |
| 114 | + 'DEFAULT_PERMISSION_CLASSES': ( |
| 115 | + 'rest_framework.permissions.IsAuthenticated', |
| 116 | + ), |
| 117 | + 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination', |
| 118 | + 'PAGE_SIZE': 10 |
| 119 | +} |
| 120 | + |
| 121 | +# DJOSER |
| 122 | +DJOSER = { |
| 123 | + 'PASSWORD_RESET_CONFIRM_URL': '#/password/reset/confirm/{uid}/{token}', |
| 124 | + 'USERNAME_RESET_CONFIRM_URL': '#/username/reset/confirm/{uid}/{token}', |
| 125 | + 'ACTIVATION_URL': '#/activate/{uid}/{token}', |
| 126 | + 'SEND_ACTIVATION_EMAIL': False, |
| 127 | + 'SERIALIZERS': {}, |
| 128 | +} |
| 129 | + |
| 130 | +# Password validation |
| 131 | +# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators |
| 132 | + |
| 133 | +AUTH_PASSWORD_VALIDATORS = [ |
| 134 | + { |
| 135 | + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', |
| 136 | + }, |
| 137 | + { |
| 138 | + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', |
| 139 | + }, |
| 140 | + { |
| 141 | + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', |
| 142 | + }, |
| 143 | + { |
| 144 | + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', |
| 145 | + }, |
| 146 | +] |
| 147 | + |
| 148 | + |
| 149 | +# Internationalization |
| 150 | +# https://docs.djangoproject.com/en/3.0/topics/i18n/ |
| 151 | + |
| 152 | +LANGUAGE_CODE = 'en-us' |
| 153 | + |
| 154 | +TIME_ZONE = 'UTC' |
| 155 | + |
| 156 | +USE_I18N = True |
| 157 | + |
| 158 | +USE_L10N = True |
| 159 | + |
| 160 | +USE_TZ = True |
| 161 | + |
| 162 | + |
| 163 | +# Static files (CSS, JavaScript, Images) |
| 164 | +# https://docs.djangoproject.com/en/3.0/howto/static-files/ |
| 165 | + |
| 166 | +STATIC_URL = '/static/' |
| 167 | +STATIC_ROOT = '/var/www/parserx.io/static' |
| 168 | +STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')] |
0 commit comments