-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
61a2919
commit 0ff596a
Showing
10 changed files
with
172 additions
and
15 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
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,14 @@ | ||
import os | ||
from celery import Celery | ||
from django.conf import settings | ||
|
||
|
||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "core.settings") | ||
|
||
app = Celery("core", broker=settings.CELERY_BROCKER_URL) | ||
app.config_from_object("django.conf:settings", namespace="CELERY") | ||
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS) | ||
|
||
@app.task(bind=True) | ||
def debug_task(self): | ||
print(f"Request: {self.request!r}") |
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 |
---|---|---|
@@ -1 +1,4 @@ | ||
from .apps import * # noqa | ||
from .celery import * # noqa | ||
from .email import * # noqa | ||
from .stripe 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,12 @@ | ||
import os | ||
|
||
CELERY_BROKER_URL = os.getenv("CELERY_BROKER_URL") | ||
CELERY_RESULT_BACKEND = "django-db" | ||
CELERY_ACCEPT_CONTENT = ["application/json"] | ||
CELERY_TASK_SERIALIZER = "json" | ||
CELERY_RESULT_SERIALIZER = "json" | ||
CELERY_TIMEZONE = "Asia/Tashkent" | ||
CELERY_TASK_TRACK_STARTED = True | ||
CELERY_TASK_TIME_LIMIT = 30 * 60 # 30m | ||
CELERY_CACHE_BACKEND = "default" | ||
CELERY_BEAT_SCHEDULER = "django_celery_beat.schedulers:DatabaseScheduler" |
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,10 @@ | ||
import os | ||
|
||
# EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend" | ||
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" | ||
EMAIL_HOST = "smtp.gmail.com" | ||
EMAIL_USE_TLS = True | ||
EMAIL_PORT = 587 | ||
EMAIL_HOST_USER = os.getenv("EMAIL_HOST_USER") | ||
EMAIL_HOST_PASSWORD = os.getenv("EMAIL_HOST_PASSWORD") | ||
EMAIL_USE_TLS = 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,5 @@ | ||
import os | ||
|
||
|
||
STRIPE_API_KEY = os.getenv("STRIPE_API_KEY") | ||
STRIPE_API_VERSION = os.getenv("STRIPE_API_VERSION") |
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,108 @@ | ||
from pathlib import Path | ||
import os | ||
|
||
from dotenv import load_dotenv | ||
|
||
from core.config import DJANGO_DEFAULT_APPS, PROJECT_APPS, THIRTY_PARTY_APPS | ||
|
||
from django.utils.translation import gettext_lazy | ||
|
||
load_dotenv() | ||
|
||
BASE_DIR = Path(__file__).resolve().parent.parent | ||
|
||
SECRET_KEY = os.getenv("SECRET_KEY") | ||
|
||
DEBUG = os.getenv("DEBUG") in ["true", "1", True] | ||
|
||
ALLOWED_HOSTS = os.getenv("DJANGO_ALLOWED_HOSTS", 'localhost').split() | ||
|
||
INSTALLED_APPS = DJANGO_DEFAULT_APPS + PROJECT_APPS + THIRTY_PARTY_APPS | ||
|
||
MIDDLEWARE = [ | ||
"django.middleware.security.SecurityMiddleware", | ||
"django.contrib.sessions.middleware.SessionMiddleware", | ||
"django.middleware.locale.LocaleMiddleware", | ||
"django.middleware.common.CommonMiddleware", | ||
"django.middleware.csrf.CsrfViewMiddleware", | ||
"django.contrib.auth.middleware.AuthenticationMiddleware", | ||
"django.contrib.messages.middleware.MessageMiddleware", | ||
"django.middleware.clickjacking.XFrameOptionsMiddleware", | ||
] | ||
|
||
ROOT_URLCONF = "core.urls" | ||
|
||
TEMPLATES = [ | ||
{ | ||
"BACKEND": "django.template.backends.django.DjangoTemplates", | ||
"DIRS": [BASE_DIR.joinpath("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", | ||
"apps.shop.context_processors.categories", | ||
"apps.cart.context_processors.cart", | ||
], | ||
}, | ||
}, | ||
] | ||
|
||
WSGI_APPLICATION = "core.wsgi.application" | ||
|
||
DATABASES = { | ||
"default": { | ||
"ENGINE": "django.db.backends.sqlite3", | ||
"NAME": BASE_DIR / "db.sqlite3", | ||
} | ||
} | ||
|
||
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", | ||
}, | ||
] | ||
|
||
|
||
def gettext(_: str): | ||
return gettext_lazy(_) | ||
|
||
|
||
LANGUAGE_CODE = "en-us" | ||
|
||
TIME_ZONE = "Asia/Tashkent" | ||
|
||
USE_I18N = True | ||
|
||
USE_TZ = True | ||
|
||
LANGUAGES = [ | ||
("en", gettext("English")), | ||
("uz", gettext("Uzbek")), | ||
] | ||
|
||
MODELTRANSLATION_DEFAULT_LANGUAGE = "en" | ||
|
||
STATIC_URL = "static/" | ||
STATIC_ROOT = BASE_DIR.joinpath("staticfiles") | ||
STATICFILES_DIRS = [BASE_DIR.joinpath("static")] | ||
|
||
MEDIA_URL = "media/" | ||
MEDIA_ROOT = BASE_DIR.joinpath("media") | ||
|
||
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" | ||
|
||
AUTH_USER_MODEL = "account.CustomUser" | ||
|
||
CART_SESSION_ID = "cart" |
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,13 @@ | ||
import os | ||
|
||
|
||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.postgresql', | ||
'NAME': os.getenv('POSTGRES_NAME'), | ||
'PASSWORD': os.getenv('POSTGRES_PASSWORD'), | ||
'USER': os.getenv('POSTGRES_USER', 'postgres'), | ||
'HOST': os.getenv('POSTGRES_HOST', 'localhost'), | ||
'PORT': os.getenv('POSTGRES_PORT', 5432) | ||
} | ||
} |