· 5 years ago · Jan 21, 2020, 09:08 PM
1"""
2Django settings for MeteoriteAppBackend project.
3
4Generated by 'django-admin startproject' using Django 3.0.2.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/3.0/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/3.0/ref/settings/
11"""
12
13import os
14
15# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
16BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17
18
19
20# Quick-start development settings - unsuitable for production
21# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
22
23# SECURITY WARNING: keep the secret key used in production secret!
24SECRET_KEY = 'qx9%*xs+qz#^cly^eu7x5-=du4(j-&+4y^25b2ydpqkjyqyf_r'
25
26# SECURITY WARNING: don't run with debug turned on in production!
27DEBUG = True
28
29ALLOWED_HOSTS = [
30 '10.0.2.2',
31 '127.0.0.1'
32]
33
34
35# Application definition
36
37INSTALLED_APPS = [
38 'django.contrib.admin',
39 'django.contrib.auth',
40 'django.contrib.contenttypes',
41 'django.contrib.sessions',
42 'django.contrib.messages',
43 'django.contrib.staticfiles',
44
45 'rest_framework',
46 'rest_framework.authtoken',
47
48 'djoser',
49
50 'Findings',
51 'storages',
52]
53
54REST_FRAMEWORK = {
55 'DEFAULT_AUTHENTICATION_CLASSES': (
56 'rest_framework.authentication.TokenAuthentication',
57 'rest_framework.authentication.SessionAuthentication',
58 ),
59}
60
61MIDDLEWARE = [
62 'django.middleware.security.SecurityMiddleware',
63 'django.contrib.sessions.middleware.SessionMiddleware',
64 'django.middleware.common.CommonMiddleware',
65 'django.middleware.csrf.CsrfViewMiddleware',
66 'django.contrib.auth.middleware.AuthenticationMiddleware',
67 'django.contrib.messages.middleware.MessageMiddleware',
68 'django.middleware.clickjacking.XFrameOptionsMiddleware',
69]
70
71ROOT_URLCONF = 'MeteoriteAppBackend.urls'
72
73TEMPLATES = [
74 {
75 'BACKEND': 'django.template.backends.django.DjangoTemplates',
76 'DIRS': [os.path.join(BASE_DIR, 'templates')]
77 ,
78 'APP_DIRS': True,
79 'OPTIONS': {
80 'context_processors': [
81 'django.template.context_processors.debug',
82 'django.template.context_processors.request',
83 'django.contrib.auth.context_processors.auth',
84 'django.contrib.messages.context_processors.messages',
85 ],
86 },
87 },
88]
89
90WSGI_APPLICATION = 'MeteoriteAppBackend.wsgi.application'
91
92
93# Database
94# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
95
96DATABASES = {
97 'default': {
98 'ENGINE': 'django.db.backends.sqlite3',
99 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
100 }
101}
102
103
104# Password validation
105# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
106
107AUTH_PASSWORD_VALIDATORS = [
108 {
109 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
110 },
111 {
112 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
113 },
114 {
115 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
116 },
117 {
118 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
119 },
120]
121
122
123# Internationalization
124# https://docs.djangoproject.com/en/3.0/topics/i18n/
125
126LANGUAGE_CODE = 'en-us'
127
128TIME_ZONE = 'UTC'
129
130USE_I18N = True
131
132USE_L10N = True
133
134USE_TZ = True
135
136
137# Static files (CSS, JavaScript, Images)
138# https://docs.djangoproject.com/en/3.0/howto/static-files/
139STATIC_URL = '/static/'
140
141
142#AMAZON S3
143# DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
144STATICFILES_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
145
146# AWS_S3_ENDPOINT_URL = 'http://meteoriteappbackend.s3-website.eu-west-2.amazonaws.com'
147# AWS_DEFAULT_ACL = None
148
149# aws settings
150AWS_ACCESS_KEY_ID = 'AKIAYPEQRAYZ3JRQSYWH'
151AWS_SECRET_ACCESS_KEY = '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'
152AWS_STORAGE_BUCKET_NAME = 'meteoriteappbackend'
153
154AWS_S3_FILE_OVERWRITE = False
155AWS_DEFAULT_ACL = 'public-read'
156AWS_S3_SIGNATURE_VERSION = 's3v4'
157
158DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'