-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Arvind-4
committed
Dec 31, 2022
1 parent
11e0140
commit 2b10b6f
Showing
10 changed files
with
257 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
""" | ||
ASGI config for backend project. | ||
It exposes the ASGI callable as a module-level variable named ``application``. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/ | ||
""" | ||
|
||
import os | ||
|
||
from django.core.asgi import get_asgi_application | ||
|
||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings') | ||
|
||
application = get_asgi_application() |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from decouple import config | ||
|
||
DJANGO_PG_DATABASE = config('DJANGO_PG_DATABASE', cast=str) | ||
DJANGO_PG_USER = config('DJANGO_PG_USER', cast=str) | ||
DJANGO_PG_PASSWORD = config('DJANGO_PG_PASSWORD', cast=str) | ||
DJANGO_PG_HOST = config('DJANGO_PG_HOST', cast=str) | ||
DJANGO_PG_PORT = config('DJANGO_PG_PORT', cast=str, default='') | ||
|
||
|
||
DB_IS_AVAILABLE = all([ | ||
DJANGO_PG_DATABASE, | ||
DJANGO_PG_USER, | ||
DJANGO_PG_PASSWORD, | ||
DJANGO_PG_HOST, | ||
DJANGO_PG_PORT, | ||
]) | ||
|
||
if DB_IS_AVAILABLE: | ||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.postgresql', | ||
'NAME': DJANGO_PG_DATABASE, | ||
'USER': DJANGO_PG_USER, | ||
'PASSWORD': DJANGO_PG_PASSWORD, | ||
'HOST': DJANGO_PG_HOST, | ||
'PORT': DJANGO_PG_PORT, | ||
} | ||
} | ||
|
||
DATABASES['default']['CONN_MAX_AGE'] = None | ||
DATABASES['default']['ATOMIC_REQUESTS'] = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from decouple import config | ||
|
||
DJANGO_LIVE = config('DJANGO_LIVE', cast=bool) | ||
|
||
if DJANGO_LIVE: | ||
from .production import * | ||
|
||
else: | ||
from .local import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
""" | ||
Django settings for sd project. | ||
Generated by 'django-admin startproject' using Django 3.2.6. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/3.2/topics/settings/ | ||
For the full list of settings and their values, see | ||
https://docs.djangoproject.com/en/3.2/ref/settings/ | ||
""" | ||
|
||
from pathlib import Path | ||
from django.contrib.messages import constants as messages | ||
|
||
# Build paths inside the project like this: BASE_DIR / 'subdir'. | ||
BASE_DIR = Path(__file__).resolve().parent.parent.parent | ||
|
||
MESSAGE_TAGS = { | ||
messages.DEBUG: 'alert-secondary', | ||
messages.INFO: 'alert-info', | ||
messages.SUCCESS: 'alert-success', | ||
messages.WARNING: 'alert-warning', | ||
messages.ERROR: 'alert-danger', | ||
} | ||
|
||
|
||
# Application definition | ||
|
||
INSTALLED_APPS = [ | ||
'django.contrib.admin', | ||
'django.contrib.auth', | ||
'django.contrib.contenttypes', | ||
'django.contrib.sessions', | ||
'django.contrib.messages', | ||
'django.contrib.staticfiles', | ||
|
||
'landing', | ||
] | ||
|
||
MIDDLEWARE = [ | ||
'django.middleware.security.SecurityMiddleware', | ||
'whitenoise.middleware.WhiteNoiseMiddleware', | ||
'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 = 'backend.urls' | ||
|
||
TEMPLATES = [ | ||
{ | ||
'BACKEND': 'django.template.backends.django.DjangoTemplates', | ||
'DIRS': [BASE_DIR / 'templates'], | ||
'APP_DIRS': True, | ||
'OPTIONS': { | ||
'context_processors': [ | ||
'django.template.context_processors.debug', | ||
'django.template.context_processors.request', | ||
'django.contrib.auth.context_processors.auth', | ||
'django.contrib.messages.context_processors.messages', | ||
], | ||
}, | ||
}, | ||
] | ||
|
||
WSGI_APPLICATION = 'backend.wsgi.application' | ||
|
||
# Password validation | ||
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators | ||
|
||
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', | ||
}, | ||
] | ||
|
||
|
||
# Internationalization | ||
# https://docs.djangoproject.com/en/3.2/topics/i18n/ | ||
|
||
LANGUAGE_CODE = 'en-us' | ||
|
||
TIME_ZONE = 'Asia/Kolkata' | ||
|
||
USE_I18N = True | ||
|
||
USE_L10N = True | ||
|
||
USE_TZ = True | ||
|
||
# Default primary key field type | ||
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field | ||
|
||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from decouple import config | ||
|
||
from .base import * | ||
|
||
SECRET_KEY = "secret_key" | ||
|
||
DEBUG = True | ||
|
||
ALLOWED_HOSTS = ['*'] | ||
|
||
ADMIN_URL = "admin/" | ||
|
||
# Database | ||
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases | ||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.sqlite3', | ||
'NAME': BASE_DIR / 'db.sqlite3', | ||
} | ||
} | ||
|
||
# Static files (CSS, JavaScript, Images) | ||
# https://docs.djangoproject.com/en/3.2/howto/static-files/ | ||
|
||
STATIC_URL = '/static/' | ||
|
||
STATICFILES_DIRS = [ | ||
BASE_DIR / 'static' | ||
] | ||
|
||
STATIC_ROOT = BASE_DIR / 'staticfiles_build' / 'static' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from decouple import config | ||
|
||
from .base import * | ||
|
||
SECRET_KEY = config('DJANGO_SECRET_KEY', cast=str) | ||
|
||
DEBUG = config('DJANGO_DEBUG', cast=bool) | ||
|
||
ALLOWED_HOSTS = ['*'] | ||
|
||
ADMIN_URL = config('DJANGO_ADMIN_URL', cast=str) | ||
|
||
STATIC_URL = '/static/' | ||
|
||
STATICFILES_DIRS = [ | ||
BASE_DIR / 'static' | ||
] | ||
|
||
STATIC_ROOT = BASE_DIR / 'staticfiles_build' / 'static' | ||
|
||
from backend.db.postgres_db import * # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
"""backend URL Configuration | ||
The `urlpatterns` list routes URLs to views. For more information please see: | ||
https://docs.djangoproject.com/en/3.2/topics/http/urls/ | ||
Examples: | ||
Function views | ||
1. Add an import: from my_app import views | ||
2. Add a URL to urlpatterns: path('', views.home, name='home') | ||
Class-based views | ||
1. Add an import: from other_app.views import Home | ||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') | ||
Including another URLconf | ||
1. Import the include() function: from django.urls import include, path | ||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) | ||
""" | ||
from django.contrib import admin | ||
from django.urls import path | ||
from django.conf import settings | ||
|
||
from landing.views import HomeView | ||
|
||
urlpatterns = [ | ||
path(str(settings.ADMIN_URL), admin.site.urls), | ||
path('', HomeView.as_view()), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
""" | ||
WSGI config for backend project. | ||
It exposes the WSGI callable as a module-level variable named ``application``. | ||
For more information on this file, see | ||
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/ | ||
""" | ||
|
||
import os | ||
|
||
from django.core.wsgi import get_wsgi_application | ||
|
||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings') | ||
|
||
application = get_wsgi_application() |