diff --git a/.env_file b/.env_file new file mode 100644 index 0000000..05a38c3 --- /dev/null +++ b/.env_file @@ -0,0 +1,7 @@ +SECRET_KEY= +DEBUG= + +EMAIL_BACKEND= + +EMAIL_HOST_USER= +EMAIL_HOST_PASSWORD= \ No newline at end of file diff --git a/Developer_Guide.md b/Developer_Guide.md index 42f7451..4aa35f7 100644 --- a/Developer_Guide.md +++ b/Developer_Guide.md @@ -24,6 +24,6 @@ python .\manage.py migrate --fake python .\manage.py runserver -# Install +# [Install this pip packages](./requirements.txt) -- [Install this pip packages](./requirements.txt) +# [make .env file with key and value](./.env_file) diff --git a/OneLink/settings.py b/OneLink/settings.py index a5d2e74..15a9d70 100644 --- a/OneLink/settings.py +++ b/OneLink/settings.py @@ -10,7 +10,7 @@ https://docs.djangoproject.com/en/3.1/ref/settings/ """ -# import secret_details +from decouple import config from django.contrib.messages import constants as messages from pathlib import Path import os @@ -24,11 +24,10 @@ # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = os.environ.get('ONELINK_SECRET_KEY') +SECRET_KEY = config('SECRET_KEY') # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = (os.environ.get('ONELINK_DEBUG_VALUE') == 'True') -DEBUG = True +DEBUG = config('DEBUG', cast=bool) ALLOWED_HOSTS = [ @@ -180,17 +179,17 @@ } -# password reset using console ( Testing purpose ) -EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' +# testing:- django.core.mail.backends.console.EmailBackend +# or +# production:- django.core.mail.backends.smtp.EmailBackend - -# # password reset using gmail account -# EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' -# EMAIL_HOST = 'smtp.gmail.com' -# EMAIL_PORT = 587 -# EMAIL_USE_TLS = True -# EMAIL_HOST_USER = os.environ.get() -# EMAIL_HOST_PASSWORD = os.environ.get() +# password reset using gmail account +EMAIL_BACKEND = config('EMAIL_BACKEND') +EMAIL_HOST = 'smtp.gmail.com' +EMAIL_PORT = 587 +EMAIL_USE_TLS = True +EMAIL_HOST_USER = config('EMAIL_HOST_USER') +EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD') # django-extensions ... graph_models GRAPH_MODELS = { diff --git a/requirements.txt b/requirements.txt index dcb40d8..83ef96e 100644 Binary files a/requirements.txt and b/requirements.txt differ diff --git a/venv_config_vars.md b/venv_config_vars.md deleted file mode 100644 index 414e2b2..0000000 --- a/venv_config_vars.md +++ /dev/null @@ -1,8 +0,0 @@ -# Virtual Environment - -### Set this variable In you Computer - -``` -ONELINK_SECRET_KEY = "SECRET_KEY of project" -ONELINK_DEBUG_VALUE = "DEBUG True or False" -```