diff --git a/core/settings.py b/core/settings.py index 81b684c..943ccbd 100644 --- a/core/settings.py +++ b/core/settings.py @@ -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 @@ -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' \ No newline at end of file diff --git a/core/urls.py b/core/urls.py index 890b124..60fee07 100644 --- a/core/urls.py +++ b/core/urls.py @@ -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 ] diff --git a/requirements.txt b/requirements.txt index c5a050c..70d0af8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 \ No newline at end of file