Skip to content

Commit

Permalink
made changes to use python-dotenv #11
Browse files Browse the repository at this point in the history
  • Loading branch information
BenFaruna committed Jun 2, 2023
1 parent f2ce960 commit 5fe16c6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
23 changes: 18 additions & 5 deletions core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,28 @@
Copyright (c) 2019 - present AppSeed.us
"""

import os
from decouple import config
import os, random, string

from dotenv import load_dotenv
from unipath import Path
import dj_database_url

load_dotenv()

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
PROJECT_DIR = Path(__file__).parent

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = config('SECRET_KEY', default='S#perS3crEt_1122')
SECRET_KEY = os.environ.get('SECRET_KEY')
if not SECRET_KEY:
SECRET_KEY = ''.join(random.choice( string.ascii_lowercase ))

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = config('DEBUG', default=False)
DEBUG = os.getenv('DEBUG', False)

# load production server from .env
ALLOWED_HOSTS = ['localhost', '127.0.0.1', config('SERVER', default='127.0.0.1')]
ALLOWED_HOSTS = ['localhost', '127.0.0.1', os.getenv('SERVER', '127.0.0.1')]

# Application definition

Expand Down Expand Up @@ -126,3 +131,11 @@
)
#############################################################
#############################################################

# Default primary key field type
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

LOGIN_REDIRECT_URL = '/'
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
1 change: 0 additions & 1 deletion core/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

urlpatterns = [
path('admin/', admin.site.urls), # Django admin route
path('admin' , admin.site.urls), # Django admin route
path("", include("authentication.urls")), # Auth routes - login / register
path("", include("app.urls")) # UI Kits Html files
]
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
asgiref
autopep8
django==2.2.10
django
pycodestyle
pytz
sqlparse
Unipath
dj-database-url
python-decouple
python-dotenv
gunicorn
whitenoise
django-import-export

0 comments on commit 5fe16c6

Please sign in to comment.