# settings/base.py
import environ
ROOT_DIR = environ.Path(__file__) - 3 # (business_management/config/settings/base.py - 3 = business_management/)APPS_DIR = ROOT_DIR.path('business_management')
# Load operating system environment variables and then prepare to use themenv = environ.Env()
# .env file, should load only in development environmentREAD_DOT_ENV_FILE = env.bool('DJANGO_READ_DOT_ENV_FILE', default=False)
if READ_DOT_ENV_FILE: # Operating System Environment variables have precedence over variables defined in the .env file, # that is to say variables from the .env files will only be used if not defined # as environment variables. env_file = str(ROOT_DIR.path('.env')) print('Loading : {}'.format(env_file)) env.read_env(env_file) print('The .env file has been loaded. See base.py for more information')
# DEBUG# ------------------------------------------------------------------------------DEBUG = env.bool('DJANGO_DEBUG', False)
# Application definition# ------------------------------------------------------------------------------
INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.sites', 'allauth', 'allauth.account', 'allauth.socialaccount', 'allauth_office365', 'bootstrap4', 'business_management.accounts', 'business_management.engineering',]
#SOCIALACCOUNT_ADAPTER = 'allauth_office365.adapter.SocialAccountAdapter'SOCIALACCOUNT_EMAIL_VERIFICATION = False
SOCIALACCOUNT_PROVIDERS = { 'office365': { 'SCOPE': ['User.read',], 'USERNAME_FIELD': 'mail' }}
MIDDLEWARE = [ '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',]
ROOT_URLCONF = 'config.urls'
TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [ str(APPS_DIR.path('templates')), ], 'OPTIONS': { 'debug': DEBUG, 'loaders': [ 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', ], 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.template.context_processors.i18n', 'django.template.context_processors.media', 'django.template.context_processors.static', 'django.contrib.messages.context_processors.messages', # Your stuff: custom template context processors go here ], }, },]
WSGI_APPLICATION = 'config.wsgi.application'
# Password validation# ------------------------------------------------------------------------------
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', },]
AUTHENTICATION_BACKENDS = ( # Needed to login by username in Django admin, regardless of `allauth` 'django.contrib.auth.backends.ModelBackend', # `allauth` specific authentication methods, such as login by e-mail 'allauth.account.auth_backends.AuthenticationBackend',)
# Internationalization# ------------------------------------------------------------------------------LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'America/Denver'
USE_I18N = True
USE_L10N = True
USE_TZ = True
STATICFILES_FINDERS = [ 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder',]
# AllAuth Settings# ------------------------------------------------------------------------------
AUTH_USER_MODEL = 'accounts.User'
SITE_ID = 1
LOGIN_REDIRECT_URL = 'dashboard'ACCOUNT_EMAIL_REQUIRED = True # email required to signupACCOUNT_EMAIL_VERIFICATION = False # email verification manditory for account verificationACCOUNT_AUTHENTICATION_METHOD = "username_email" # username or email#ACCOUNT_LOGIN_ON_EMAIL_CONFIRMATION = True#VERIFIED_EMAIL = True#ACCOUNT_FORMS = {'login': 'accounts.forms.MyLoginForm', 'sign_up': 'accounts.forms.MySignupForm'}ACCOUNT_LOGIN_ATTEMPTS_LIMIT = 5ACCOUNT_LOGIN_ATTEMPTS_TIMEOUT = 300#ACCOUNT_SIGNUP_FORM_CLASS = 'business_management.accounts.forms.UserCreateForm'ACCOUNT_USERNAME_MIN_LENGTH = 4ACCOUNT_LOGOUT_REDIRECT_URL = 'account_login'#ACCOUNT_SESSION_REMEMBER = None # Controls the life time of the session. Set to None to ask the user 'Remember me?', False to not remember, and True to always remember.
from .base import *
import json
DEBUG = False
WHITENOISE_MIDDLEWARE = ['whitenoise.middleware.WhiteNoiseMiddleware', ]MIDDLEWARE = WHITENOISE_MIDDLEWARE + MIDDLEWARE
INSTALLED_APPS += ['gunicorn', ]
# Static File Configuration# ------------------------------------------------------------------------------STATIC_ROOT = str(ROOT_DIR('staticfiles'))
STATIC_URL = "/staticfiles/"
STATICFILES_DIRS = [ str(APPS_DIR.path('static')),]
Hi,
1) What is environ? Could you point to its documentation page?
2) Could you show your nginx configuration?
Antonis Christofides http://djangodeployment.com
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3e9f167b-6c09-4dec-85b2-a1617a37646e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
server { listen 80; server_name [domain name]; ssl_dhparam /etc/ssl/certs/dhparam.pem;
location = /favicon.ico { access_log off; log_not_found off; } location /staticfiles/ { root /home/business_management; }
location / { include proxy_params; proxy_pass http://unix:/home/business_management/business_management.sock; }}