first commit
This commit is contained in:
commit
3e4574dcdd
163 files changed
+3559
No files matched your search
@@ -0,0 +1,7 @@
|
||||
import os
|
||||
django_env = os.getenv('DJANGO_ENV', 'local')
|
||||
if django_env == 'local':
|
||||
from .local import *
|
||||
elif django_env == 'production':
|
||||
from .production import *
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
"""
|
||||
Django settings for bashgah project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 5.0.3.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/5.0/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/5.0/ref/settings/
|
||||
"""
|
||||
import os
|
||||
from pathlib import Path
|
||||
from datetime import timedelta
|
||||
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'django-insecure-3sf^ag=#a2jfpv!*6v4=6suvdcn50e$o%+v6-46y)ck-*lfpu5'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
OTP_BYPASS = False
|
||||
|
||||
ALLOWED_HOSTS = ['*']
|
||||
|
||||
CORS_ALLOWED_ORIGINS = [
|
||||
"http://localhost:3000",
|
||||
"http://localhost:3001",
|
||||
"https://bashgah.liara.run",
|
||||
"https://lgg-bashgah.liara.run",
|
||||
"https://bashgah.loolegostar.com",
|
||||
"https://mojrian.loolegostar.com",
|
||||
"https://admin-mojrian.loolegostar.com",
|
||||
"https://admin-mojrian.liara.run",
|
||||
]
|
||||
|
||||
AUTH_USER_MODEL = 'cuser.CUser'
|
||||
|
||||
# Application definition
|
||||
LOCAL_APPS = [
|
||||
'apps.cuser',
|
||||
'apps.product',
|
||||
'apps.appsetting',
|
||||
'apps.userprofile',
|
||||
'apps.dgcode',
|
||||
'apps.order',
|
||||
'apps.project',
|
||||
'apps.user_auth',
|
||||
'apps.emtiyazat',
|
||||
'apps.projectcode',
|
||||
]
|
||||
|
||||
THIRD_PARTY_APPS = [
|
||||
'rest_framework',
|
||||
'drf_spectacular',
|
||||
'django_filters',
|
||||
'corsheaders',
|
||||
'debug_toolbar',
|
||||
'import_export',
|
||||
]
|
||||
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
*THIRD_PARTY_APPS,
|
||||
*LOCAL_APPS,
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'corsheaders.middleware.CorsMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
'debug_toolbar.middleware.DebugToolbarMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'config.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 = 'config.wsgi.application'
|
||||
|
||||
|
||||
SIMPLE_JWT = {
|
||||
"ACCESS_TOKEN_LIFETIME": timedelta(minutes=30),
|
||||
"REFRESH_TOKEN_LIFETIME": timedelta(days=30),
|
||||
}
|
||||
|
||||
REST_FRAMEWORK = {
|
||||
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||
'rest_framework_simplejwt.authentication.JWTAuthentication',
|
||||
'rest_framework.authentication.SessionAuthentication',
|
||||
)
|
||||
}
|
||||
|
||||
# Database !
|
||||
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql',
|
||||
'NAME': 'bashgah-dev2',
|
||||
'USER': 'postgres',
|
||||
'PASSWORD': '335577!@',
|
||||
'HOST': '127.0.0.1',
|
||||
'PORT': '5432'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/5.0/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/5.0/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
USE_TZ = True
|
||||
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/5.0/howto/static-files/
|
||||
|
||||
STATIC_URL = 'static/'
|
||||
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
||||
|
||||
|
||||
# Default primary key field type
|
||||
# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field
|
||||
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
|
||||
|
||||
CELERY_BROKER_URL = "redis://127.0.0.1:6379/0"
|
||||
#CELERY_TIMEZONE = "Australia/Tasmania"
|
||||
CELERY_RESULT_BACKEND = "redis://localhost:6379"
|
||||
CELERY_BROKER_CONNECTION_RETRY_ON_STARTUP = True
|
||||
CELERY_TIMEZONE = 'Asia/Tehran'
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
from .base import *
|
||||
|
||||
OTP_BYPASS = True
|
||||
|
||||
INTERNAL_IPS = [
|
||||
# ...
|
||||
"127.0.0.1",
|
||||
# ...
|
||||
]
|
||||
CACHES = {
|
||||
"default": {
|
||||
"BACKEND": "django_redis.cache.RedisCache",
|
||||
"LOCATION": "redis://127.0.0.1:6379/1",
|
||||
"KEY_PREFIX": "bashgah",
|
||||
"OPTIONS": {
|
||||
"CLIENT_CLASS": "django_redis.client.DefaultClient",
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
from .base import *
|
||||
|
||||
DEBUG = os.getenv('DJANGO_DEBUG', False)
|
||||
OTP_BYPASS = False
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
MEDIA_URL = '/media/'
|
||||
MEDIA_ROOT = BASE_DIR.parent /'media'
|
||||
INTERNAL_IPS = [
|
||||
# ...
|
||||
"127.0.0.1",
|
||||
"37.255.224.143",
|
||||
# ...
|
||||
]
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql',
|
||||
'NAME': 'bashgah',
|
||||
'USER': 'root',
|
||||
'PASSWORD': '1yI0Iw2Fpjm2BXhEnwUKVdDg',
|
||||
'HOST': 'loolegostar-db',
|
||||
'PORT': '5432'
|
||||
}
|
||||
}
|
||||
|
||||
CACHES = {
|
||||
"default": {
|
||||
"BACKEND": "django_redis.cache.RedisCache",
|
||||
"LOCATION": "redis://:rIlY5pkNzY11ZUSdXHw6hu0n@bashgah-redis:6379/1",
|
||||
"KEY_PREFIX": "bashgah",
|
||||
"OPTIONS": {
|
||||
"CLIENT_CLASS": "django_redis.client.DefaultClient",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CELERY_BROKER_URL = "redis://:rIlY5pkNzY11ZUSdXHw6hu0n@bashgah-redis:6379/0"
|
||||
CELERY_TIMEZONE = 'Asia/Tehran'
|
||||
CELERY_RESULT_BACKEND = "redis://:rIlY5pkNzY11ZUSdXHw6hu0n@bashgah-redis:6379/0"
|
||||
CELERY_BROKER_CONNECTION_RETRY_ON_STARTUP = True
|
||||
Reference in new issue
Block a user