Example #1
0
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


# Internationalization
# https://docs.djangoproject.com/en/1.9/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'Asia/Yekaterinburg'

USE_I18N = True

USE_L10N = True

#USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/
LOGIN_URL = '/login/'
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
# Simplified static file serving.
# https://warehouse.python.org/project/whitenoise/

STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'

django_heroku.settings(locals())
Example #2
0
MEDIAFILES_LOCATION = 'media'
MEDIA_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, MEDIAFILES_LOCATION)
DEFAULT_FILE_STORAGE = 'playacamp.custom_storages.MediaStorage'

LOGIN_URL = "/login"
LOGIN_REDIRECT_URL = "/profile/me"

NOCAPTCHA = True
RECAPTCHA_PUBLIC_KEY = os.environ.get('RECAPTCHA_PUBLIC_KEY')
RECAPTCHA_PRIVATE_KEY = os.environ.get('RECAPTCHA_PRIVATE_KEY')

GOOGLE_ANALYTICS_TRACKING_ID = os.environ.get('GOOGLE_ANALYTICS_TRACKING_ID')

EMAIL_HOST = os.environ.get('EMAIL_HOST')
EMAIL_PORT = os.environ.get('EMAIL_PORT')
EMAIL_USE_TLS = os.environ.get('EMAIL_USE_TLS') == '1'
EMAIL_USE_SSL = os.environ.get('EMAIL_USE_SSL') == '1'
EMAIL_HOST_USER = os.environ.get('EMAIL_HOST_USER')
EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_HOST_PASSWORD')
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

SECURE_SSL_REDIRECT = not DEBUG

REGISTRATION_CLOSED = os.environ.get('REGISTRATION_CLOSED')

import django_heroku
django_heroku.settings(locals(), test_runner=False)

SASS_PROCESSOR_ROOT = STATIC_ROOT
Example #3
0
STATIC_URL = '/static/'

STATICFILES_DIRS = (
    os.path.join(BASE_DIR, "static"),
)

# Media file settings
MEDIA_URL = '/media/'

MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

DEFAULT_FILE_STORAGE = 'jurycore.helpers.s3fix.CustomS3Boto3Storage'

AWS_ACCESS_KEY_ID = os.environ['AWS_ACCESS_KEY_ID']

AWS_SECRET_ACCESS_KEY = os.environ['AWS_SECRET_ACCESS_KEY']

AWS_STORAGE_BUCKET_NAME = os.environ['S3_BUCKET_NAME']

AWS_S3_REGION_NAME = os.environ['S3_REGION']  # "eu-central-1"

RAVEN_CONFIG = {
    'dsn': 'https://*****:*****@sentry.io/1247824',
    # If you are using git, you can also automatically configure the
    # release based on the git info.
    'release': '1',
}

# Configure Django App for Heroku.
django_heroku.settings(locals(), staticfiles=False)
Example #4
0
            ],
        },
    },
]

WSGI_APPLICATION = 'root.wsgi.application'


# Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
        'DATABASE_URL' : django_heroku.settings(locals()),
    }
}


# Password validation
# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
Example #5
0
TIME_ZONE = os.environ.get('TIME_ZONE', 'UTC')

USE_I18N = True

USE_L10N = True

USE_TZ = True

LOGIN_REDIRECT_URL = '/'

# Change the tag for error messages to "warning" so that it works nicely
# with Bootstrap classes
DEFAULT_TAGS[ERROR] = 'warning'

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/dev/howto/static-files/
STATIC_ROOT = os.environ.get('STATIC_ROOT')
STATIC_URL = os.environ.get('STATIC_URL')

REDIS_URL = os.environ.get('REDIS_URL')
CELERY_BROKER_URL = os.environ.get('CELERY_BROKER_URL') or REDIS_URL
CELERY_RESULT_BACKEND = 'django-db'
CELERY_CACHE_BACKEND = 'django-cache'
CELERY_ALWAYS_EAGER = (os.environ.get('CELERY_ALWAYS_EAGER', 'false').lower()
                       in ('true', 'yes'))

if os.environ['DEPLOY_ENV'] == 'heroku':
    import django_heroku
    django_heroku.settings(locals(), allowed_hosts=False, databases=False)
Example #6
0
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


# Internationalization
# https://docs.djangoproject.com/en/3.0/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/

STATIC_URL = '/static/'


STATIC_ROOT = '/var/sleepy-beach-55370/static/'
import django_heroku
django_heroku.settings(locals())
Example #7
0
CSP_REPORT_ONLY = config('CSP_REPORT_ONLY', default='false', parser=bool)
CSP_REPORT_ENABLE = config('CSP_REPORT_ENABLE', default='false', parser=bool)
if CSP_REPORT_ENABLE:
    CSP_REPORT_URI = config('CSP_REPORT_URI', default='/csp-violation-capture')

# Static files (CSS, JavaScript, Images)
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'django.contrib.staticfiles.finders.FileSystemFinder',
)
STATICFILES_DIRS = (
    path('static_build'),
)
WHITENOISE_ROOT = path('root_files')

RAVEN_CONFIG = {
    'dsn': config('SENTRY_DSN', raise_error=False),
    'release': config('GIT_SHA', raise_error=False),
}

# Configure Django App for Heroku. Sets up db, logging, static files, and some
# other things.
import django_heroku  # noqa
django_heroku.settings(locals(), test_runner=False, allowed_hosts=False)


# Stomp on some STATICFILES_STORAGE setting from django-heroku
DEFAULT_SF_STORAGE = ('django.contrib.staticfiles.storage.StaticFilesStorage' if DEBUG else
                      'whitenoise.storage.CompressedManifestStaticFilesStorage')
STATICFILES_STORAGE = config('STATICFILES_STORAGE', default=DEFAULT_SF_STORAGE)
Example #8
0
    {
        'NAME':
        'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]

# Internationalization
# 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)

ROOT_URLCONF = 'project.urls'  #check if you have this already, if not add it in

STATIC_URL = '/static/'

STATICFILES_DIRS = (os.path.join(BASE_DIR, 'frontend', "build", "static"), )

# https://docs.djangoproject.com/en/2.0/howto/static-files/

django_heroku.settings(locals())  # put this last
Example #9
0
USE_TZ = True

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/
#
STATIC_URL = '/static/'

STATICFILES_DIRS = [
    os.path.join(APP_ROOT, 'static'),
]

FIXTURE_DIRS = [
    os.path.join(APP_ROOT, 'fixtures'),
]

MEDIA_ROOT = os.path.join(APP_ROOT, 'media/')
MEDIA_URL = 'media/'

SESSION_EXPIRE_AT_BROWSER_CLOSE = False

LOGIN_NOT_REQUIRED = (
    r'^/login/$',
    r'/login/esqueceu/',
    r'/login/trocarsenha/',
    r'/logout/',
)

# Activate Django-Heroku.
django_heroku.settings(locals(), test_runner=False)
Example #10
0
            'propagate': False,
        },
        'django.db.backends': {
            'level': 'ERROR',
            'handlers': ['console'],
            'propagate': False,
        },
        'raven': {
            'level': 'DEBUG',
            'handlers': ['console'],
            'propagate': False,
        },
        'sentry.errors': {
            'level': 'DEBUG',
            'handlers': ['console'],
            'propagate': False,
        },
    },
}

ADMIN_ENABLED = False

django_heroku.settings(
    locals(),
    allowed_hosts=False,
    logging=False,
    secret_key=False,
    staticfiles=False,
    test_runner=False
)
ADMINS = config('ADMINS', cast=csv, default='(John, [email protected])%')
MANAGERS = ADMINS

# HTTPS
CSRF_COOKIE_SECURE = config('CSRF_COOKIE_SECURE', default=True, cast=bool)
SESSION_COOKIE_SECURE = config('SESSION_COOKIE_SECURE',
                               default=True,
                               cast=bool)
SECURE_SSL_REDIRECT = config('SECURE_SSL_REDIRECT', default=True, cast=bool)

# Clickjacking protection : prevent the site from being rendered inside an <iframe>
X_FRAME_OPTIONS = config('X_FRAME_OPTIONS', default='DENY')

# Activate the browser's XSS filtering
SECURE_BROWSER_XSS_FILTER = config('SECURE_BROWSER_XSS_FILTER',
                                   default=True,
                                   cast=bool)

# Prevent the browser from identifying content types incorrectly
SECURE_CONTENT_TYPE_NOSNIFF = config('SECURE_CONTENT_TYPE_NOSNIFF',
                                     default=True,
                                     cast=bool)

# Auto-configuring databases, test_runner(for Heroku CI), staticfiles and logging
# but not ALLOWED_HOSTS since it is handled better by python-decouple
django_heroku.settings(locals(),
                       allowed_hosts=False,
                       staticfiles=config('STATICFILES',
                                          default=True,
                                          cast=bool))
Example #12
0
# https://docs.djangoproject.com/en/3.0/howto/static-files/

AWS_ACCESS_KEY_ID = env('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = env('AWS_SECRET_ACCESS_KEY')
AWS_STORAGE_BUCKET_NAME = env('AWS_STORAGE_BUCKET_NAME')
AWS_S3_HOST = 's3.us-east-1.amazonaws.com'
AWS_DEFAULT_ACL = 'public-read'
AWS_S3_CUSTOM_DOMAIN = '%s.s3.amazonaws.com' % AWS_STORAGE_BUCKET_NAME
AWS_S3_OBJECT_PARAMETERS = {
    'CacheControl': 'max-age=86400',
}
AWS_LOCATION = ''
AWS_S3_FILE_OVERWRITE = False
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'project/static'),
]
STATIC_URL = 'https://%s/%s/' % (AWS_S3_CUSTOM_DOMAIN, AWS_LOCATION)
STATICFILES_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
UPLOAD_TO = env('UPLOAD_TO')

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_USE_TLS = True
EMAIL_PORT = 587
EMAIL_HOST_USER = "******"
EMAIL_HOST_PASSWORD = env('EMAIL_HOST_PASSWORD')
EMAIL_PASSWORD = env('EMAIL_PASSWORD')

django_heroku.settings(locals(), test_runner=False, staticfiles=False)
Example #13
0
        '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 = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")  # new! for heroku
STATIC_URL = '/static/'
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, "static"),
]
#STATICFILES_STORAGE ='whitenoise.storage.CompressedManifestStaticFilesStorage' #new! for heroku
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'  #new! for heroku
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
CORS_ORIGIN_ALLOW_ALL = True  #new! for api
# Activate Django-Heroku.
django_heroku.settings(locals())  #new! for heroku

GRAPHENE = {'SCHEMA': 'online_bookshop.schema.schema'}
Example #14
0
    # Moves static files from frontend to server side
    os.path.join(REACT_APP_DIR, "static"),
    REACT_APP_DIR,
)

STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'

# Media files
MEDIA_URL = '/media/'

# Information about the location media files
MEDIA_ROOT = os.path.join(BASE_DIR, MEDIA_URL)

if "IS_HEROKU" in os.environ:
    # Activate Django-Heroku.
    django_heroku.settings(locals(), staticfiles=False)

# Rest framework auth backend
REST_FRAMEWORK = {
    'DEFAULT_AUTHENTICATION_CLASSES': [
        'rest_framework.authentication.TokenAuthentication',
    ]
}

# Django email backend
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'handlers': {