· 7 years ago · Jul 30, 2018, 08:38 AM
1"""
2 Django settings for BuildMap project. Generated by 'django-admin startproject' using Django 2.0.5. For more information on this file, see https://docs.djangoproject.com/en/2.0/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.0/ref/settings/
3""" import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
4BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
5# Quick-start development settings - unsuitable for production
6# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret!
7SECRET_KEY = '^awefs#15xdsktucila)7-*85qk-l7l6js7-g2$4r!+4fa9r9=' # SECURITY WARNING: don't run with debug turned on in production!
8DEBUG = True ALLOWED_HOSTS = ['*'] # Application definition DJANGO_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.gis'
9) LIBS = ( 'rest_framework', 'rest_framework.authtoken', 'rest_framework_gis',
10'django_filters',
11'corsheaders',
12# 'raster',
13# 'wms'
14) APPS = ( 'backend.accounts',
15'backend.base',
16'backend.core',
17'backend.mapping',
18# 'backend.layers'
19 ) INSTALLED_APPS = DJANGO_APPS + LIBS + APPS + ('storages',) MIDDLEWARE = [ 'corsheaders.middleware.CorsMiddleware', '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',
20] ROOT_URLCONF = 'backend.urls' TEMPLATES = [
21{
22'BACKEND': 'django.template.backends.django.DjangoTemplates',
23'DIRS': [],
24'APP_DIRS': True,
25'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',
26],
27},
28 },
29] WSGI_APPLICATION = 'backend.wsgi.application' # Database
30# https://docs.djangoproject.com/en/2.0/ref/settings/#databases DATABASES = {
31'default': {
32'ENGINE': 'django.contrib.gis.db.backends.postgis',
33'NAME': 'mapxprod',
34'USER': 'mapxuser',
35'PASSWORD': 'mapx1234',
36'HOST': 'mapx.c4guvljxxnfh.ap-south-1.rds.amazonaws.com',
37'PORT': '5432',
38}
39} REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework.authentication.TokenAuthentication',
40), 'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',)
41} # Password validation
42# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [
43{
44'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
45},
46{
47'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
48},
49{
50'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
51},
52{
53'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
54},
55] # Internationalization
56# https://docs.djangoproject.com/en/2.0/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images)
57# https://docs.djangoproject.com/en/2.0/howto/static-files/ STATICFILES_LOCATION = 'layer-images' STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
58#STATIC_ROOT = os.path.join(BASE_DIR, 'layer-images')
59#STATIC_URL = '/layer-images/'
60#STATIC_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, STATICFILES_LOCATION) STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
61) AUTH_USER_MODEL = "accounts.User" CORS_ORIGIN_ALLOW_ALL = True #MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
62#MEDIAFILES LOCATION = 'med'
63#MEDIA_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, MEDIAFILES_LOCATION) #MEDIAFILES_STORAGE = 'storages.backends.s3boto.S3Boto3Storage' AWS_ACCESS_KEY_ID = 'AKIAJ7LKY2NWPAGCDIRA' AWS_SECRET_ACCESS_KEY = '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' AWS_STORAGE_BUCKET_NAME = 'mapxs3' AWS_S3_CUSTOM_DOMAIN = '%s.s3.amazonaws.com' % AWS_STORAGE_BUCKET_NAME #DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3Boto3Storage' MEDIAFILES_LOCATION = 'media'
64MEDIA_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, MEDIAFILES_LOCATION) DEFAULT_FILE_STORAGE = 'custom_storages.MediaStorage'
65MEDIA_ROOT = DEFAULT_FILE_STORAGE
66STATIC_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, STATICFILES_LOCATION)