diff options
author | CruiseDevice | 2018-10-29 20:45:43 +0530 |
---|---|---|
committer | CruiseDevice | 2018-10-29 21:00:52 +0530 |
commit | 71a3ec2e1c59ba42e18c2cbf89ec79eae82cd27b (patch) | |
tree | 3e035dacceb5536c1d17925ce1d69879b8cb89e1 | |
parent | f904c6be625b93858bf5262d75f1fbb1a98c6a86 (diff) | |
download | sbhs_server-71a3ec2e1c59ba42e18c2cbf89ec79eae82cd27b.tar.gz sbhs_server-71a3ec2e1c59ba42e18c2cbf89ec79eae82cd27b.tar.bz2 sbhs_server-71a3ec2e1c59ba42e18c2cbf89ec79eae82cd27b.zip |
Add credentials in settings.
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | sbhs_server/credentials.py | 11 | ||||
-rw-r--r-- | sbhs_server/settings.py | 36 |
3 files changed, 34 insertions, 15 deletions
@@ -46,7 +46,5 @@ wsgi.log *.sqlite3 data/ _build/ -sbhs_server/secret.py -sbhs_server/credentials.py *.log experiments diff --git a/sbhs_server/credentials.py b/sbhs_server/credentials.py new file mode 100644 index 0000000..99550fd --- /dev/null +++ b/sbhs_server/credentials.py @@ -0,0 +1,11 @@ +PROJECT_SECRET_KEY = "Enter your secret key" +EMAIL_HOST_USER = "Enter your SMTP server host user name" +EMAIL_HOST_PASSWORD = 'Enter your SMTP host password' +SENDER_EMAIL = "Enter your sender email id" +REPLY_EMAIL = "Enter your reply email id" +PRODUCTION_URL = "Enter your Production url" +DB_NAME = 'Enter your Database Name' +DB_USER = 'Enter your database username' +DB_PASS = 'Enter your database password' +DB_HOST = 'Enter your database host IP' +DB_PORT = 'Enter your database port number' diff --git a/sbhs_server/settings.py b/sbhs_server/settings.py index 433ffa9..4b1e756 100644 --- a/sbhs_server/settings.py +++ b/sbhs_server/settings.py @@ -11,11 +11,14 @@ https://docs.djangoproject.com/en/1.11/ref/settings/ """ import os -import sbhs_server.secret as credentials +from sbhs_server import credentials # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +# Set this variable to <False> once the project is in production. +# If this variable is kept <True> in production, email will not be verified. +IS_DEVELOPMENT=True # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.11/sudo cat /var/log/auth.log | grep "session opened for user root"howto/deployment/checklist/ @@ -39,7 +42,6 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', - 'widget_tweaks', 'crispy_forms', ] @@ -78,13 +80,24 @@ WSGI_APPLICATION = 'sbhs_server.wsgi.application' # Database # https://docs.djangoproject.com/en/1.11/ref/settings/#databases -DATABASES = { - 'default': { +if not IS_DEVELOPMENT: + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME': credentials.DB_NAME, + 'USER': credentials.DB_USER, + 'PASSWORD': credentials.DB_PASS, + 'HOST': credentials.DB_HOST, + 'PORT': credentials.DB_PORT, + } + } +else: + DATABASES = { + 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), - } -} - + } + } # Password validation # https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators @@ -149,23 +162,20 @@ EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' # This email id will be used as <from address> for sending emails. # For example no_reply@<your_organization>.in can be used. -SENDER_EMAIL = 'Write Sender Email ID' +SENDER_EMAIL = credentials.SENDER_EMAIL # Organisation/Indivudual Name. SENDER_NAME = 'SBHS Team' # This email id will be used by users to send their queries # For example queries@<your_organization>.in can be used. -REPLY_EMAIL = 'Write Reply-to Email ID' +REPLY_EMAIL = credentials.REPLY_EMAIL # This url will be used in email verification to create activation link. # Add your hosted url to this variable. # For example https://127.0.0.1:8000 or 127.0.0.1:8000 -PRODUCTION_URL = '127.0.0.1:8000' +PRODUCTION_URL = credentials.PRODUCTION_URL -# Set this variable to <False> once the project is in production. -# If this variable is kept <True> in production, email will not be verified. -IS_DEVELOPMENT=True DEFAULT_FROM_EMAIL = EMAIL_HOST_USER |