gold eggs backend
Some checks failed
Build and Push to Docker Hub / build-test-push (push) Failing after 1m55s

This commit is contained in:
2026-04-15 08:59:36 +02:00
commit ab73d05ecc
359 changed files with 14415 additions and 0 deletions

3
config/__init__.py Executable file
View File

@@ -0,0 +1,3 @@
from .celery import app
__all__ = ["app"]

9
config/asgi.py Executable file
View File

@@ -0,0 +1,9 @@
import os
from django.core.asgi import get_asgi_application
from common.env import env
os.environ.setdefault("DJANGO_SETTINGS_MODULE", env("DJANGO_SETTINGS_MODULE"))
application = get_asgi_application()

20
config/celery.py Executable file
View File

@@ -0,0 +1,20 @@
"""
Celery configurations
"""
from __future__ import absolute_import
from __future__ import unicode_literals
import os
import celery
from django.conf import settings
from common.env import env
os.environ.setdefault("DJANGO_SETTINGS_MODULE", env("DJANGO_SETTINGS_MODULE"))
app = celery.Celery("config")
app.config_from_object("django.conf:settings", namespace="CELERY")
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)

8
config/conf/__init__.py Executable file
View File

@@ -0,0 +1,8 @@
from . import apps # noqa
from .cache import * # noqa
from .ckeditor import * # noqa
from .cron import * # noqa
from .jazzmin import * # noqa
from .jwt import * # noqa
from .logs import * # noqa
from .rest_framework import * # noqa

24
config/conf/apps.py Normal file
View File

@@ -0,0 +1,24 @@
#####################
# My Settings
#####################
INSTALLED_APPS = [
"rest_framework",
"corsheaders",
"django_filters",
"rosetta",
"django_redis",
"rest_framework_simplejwt",
"drf_yasg",
"crispy_forms",
"import_export",
"django_ckeditor_5",
"polymorphic",
#####################
# My apps
#####################
"core.apps.home.apps.HomeConfig",
"core.http.HttpConfig",
"core.apps.accounts.apps.AccountsConfig",
"core.console.ConsoleConfig",
"core.apps.eggs.apps.EggsConfig",
]

11
config/conf/cache.py Executable file
View File

@@ -0,0 +1,11 @@
from common.env import env
CACHES = {
"default": {
"BACKEND": env("CACHE_BACKEND"),
"LOCATION": env("REDIS_URL"),
"TIMEOUT": env("CACHE_TIMEOUT"),
},
}
# CACHE_MIDDLEWARE_SECONDS = env("CACHE_TIMEOUT")

147
config/conf/ckeditor.py Executable file
View File

@@ -0,0 +1,147 @@
import os
from pathlib import Path
STATIC_URL = "/static/"
MEDIA_URL = "/media/"
MEDIA_ROOT = os.path.join(Path().parent.parent, "media")
customColorPalette = [
{"color": "hsl(4, 90%, 58%)", "label": "Red"},
{"color": "hsl(340, 82%, 52%)", "label": "Pink"},
{"color": "hsl(291, 64%, 42%)", "label": "Purple"},
{"color": "hsl(262, 52%, 47%)", "label": "Deep Purple"},
{"color": "hsl(231, 48%, 48%)", "label": "Indigo"},
{"color": "hsl(207, 90%, 54%)", "label": "Blue"},
]
CKEDITOR_5_CONFIGS = {
"default": {
"toolbar": [
"heading",
"|",
"bold",
"italic",
"link",
"bulletedList",
"numberedList",
"blockQuote",
"imageUpload",
],
},
"extends": {
"blockToolbar": [
"paragraph",
"heading1",
"heading2",
"heading3",
"|",
"bulletedList",
"numberedList",
"|",
"blockQuote",
],
"toolbar": [
"heading",
"|",
"outdent",
"indent",
"|",
"bold",
"italic",
"link",
"underline",
"strikethrough",
"code",
"subscript",
"superscript",
"highlight",
"|",
"codeBlock",
"sourceEditing",
"insertImage",
"bulletedList",
"numberedList",
"todoList",
"|",
"blockQuote",
"imageUpload",
"|",
"fontSize",
"fontFamily",
"fontColor",
"fontBackgroundColor",
"mediaEmbed",
"removeFormat",
"insertTable",
],
"image": {
"toolbar": [
"imageTextAlternative",
"|",
"imageStyle:alignLeft",
"imageStyle:alignRight",
"imageStyle:alignCenter",
"imageStyle:side",
"|",
],
"styles": [
"full",
"side",
"alignLeft",
"alignRight",
"alignCenter",
],
},
"table": {
"contentToolbar": [
"tableColumn",
"tableRow",
"mergeTableCells",
"tableProperties",
"tableCellProperties",
],
"tableProperties": {
"borderColors": customColorPalette,
"backgroundColors": customColorPalette,
},
"tableCellProperties": {
"borderColors": customColorPalette,
"backgroundColors": customColorPalette,
},
},
"heading": {
"options": [
{
"model": "paragraph",
"title": "Paragraph",
"class": "ck-heading_paragraph",
},
{
"model": "heading1",
"view": "h1",
"title": "Heading 1",
"class": "ck-heading_heading1",
},
{
"model": "heading2",
"view": "h2",
"title": "Heading 2",
"class": "ck-heading_heading2",
},
{
"model": "heading3",
"view": "h3",
"title": "Heading 3",
"class": "ck-heading_heading3",
},
]
},
},
"list": {
"properties": {
"styles": "true",
"startIndex": "true",
"reversed": "true",
}
},
}

0
config/conf/cron.py Executable file
View File

127
config/conf/jazzmin.py Executable file
View File

@@ -0,0 +1,127 @@
from typing import Any
JAZZMIN_SETTINGS: dict[str | Any, str | None | Any] = {
"site_title": "Felix IT Solution",
"site_header": "Felix IT Solution",
"site_brand": "Felix IT Solution",
"site_logo": "/images/logo.png",
"login_logo": None,
"login_logo_dark": None,
"site_logo_classes": "img-circle",
"site_icon": None,
"welcome_sign": "Felix IT Solution",
"copyright": "Felix IT Solution LLC",
"search_model": ["auth.User"],
"user_avatar": None,
"topmenu_links": [
{
"name": "Home",
"url": "admin:index",
"permissions": ["auth.view_user"],
},
{
"name": "Support",
"url": "https://github.com/farridav/django-jazzmin/issues",
"new_window": True,
},
{"model": "auth.User"},
{"app": "books"},
],
"usermenu_links": [
{
"name": "Support",
"url": "https://github.com/farridav/django-jazzmin/issues",
"new_window": True,
},
{"model": "auth.user"},
],
"show_sidebar": True,
"navigation_expanded": True,
"hide_apps": [],
"hide_models": [],
"order_with_respect_to": ["auth", "books", "books.author", "books.book"],
"custom_links": {
"books": [
{
"name": "Make Messages",
"url": "make_messages",
"icon": "fas fa-comments",
"permissions": ["books.view_book"],
}
]
},
"icons": {
"http.Comment": "fas fa-comments",
"http.FrontendTranslation": "fas fa-globe",
"http.Post": "fas fa-bars",
"http.User": "fas fa-user",
"http.Tags": "fas fa-tag",
"http.SmsConfirm": "fas fa-comments",
"auth.Group": "fas fa-users",
"eggs.Courier": "fas fa-user-tie",
"eggs.CourierHistory": "fas fa-history",
"eggs.CourierProduct": "fas fa-envelope-open-text",
"eggs.Group": "fas fa-users",
"eggs.Party": "fas fa-person-booth",
"eggs.Product": "fas fa-egg",
"eggs.Invoice": "fas fa-envelope-open-text",
"eggs.Location": "fas fa-location-arrow",
"eggs.Market": "fas fa-store",
"eggs.Order": "fas fa-envelope-open-text",
"eggs.OrderItems": "fas fa-object-group",
"eggs.Broken": "fas fa-trash-alt",
"eggs.Debt": "fas fa-hand-holding-usd",
"eggs.History": "fas fa-history",
"eggs.AllHistory": "fas fa-history",
"eggs.AdditionalCost": "fas fa-money-bill-wave",
"eggs.Sklad": "fas fa-warehouse",
"eggs.Monitoring": "fas fa-chart-line",
"eggs.Notification": "fas fa-bell",
},
"default_icon_parents": "fas fa-chevron-circle-right",
"default_icon_children": "fas fa-circle",
"related_modal_active": False,
"custom_css": "css/jazzmin.css",
"custom_js": None,
"use_google_fonts_cdn": True,
"show_ui_builder": False,
"changeform_format": "horizontal_tabs",
"changeform_format_overrides": {
"auth.user": "collapsible",
"auth.group": "vertical_tabs",
},
"language_chooser": True,
}
JAZZMIN_UI_TWEAKS = {
"navbar_small_text": False,
"footer_small_text": False,
"body_small_text": True,
"brand_small_text": False,
"brand_colour": "navbar-navy",
"accent": "accent-primary",
"navbar": "navbar-navy navbar-dark",
"no_navbar_border": False,
"navbar_fixed": True,
"layout_boxed": False,
"footer_fixed": False,
"sidebar_fixed": True,
"sidebar": "sidebar-dark-navy",
"sidebar_nav_small_text": False,
"sidebar_disable_expand": False,
"sidebar_nav_child_indent": False,
"sidebar_nav_compact_style": True,
"sidebar_nav_legacy_style": False,
"sidebar_nav_flat_style": False,
"theme": "minty",
"dark_mode_theme": None,
"button_classes": {
"primary": "btn-outline-primary",
"secondary": "btn-outline-secondary",
"info": "btn-outline-info",
"warning": "btn-warning",
"danger": "btn-danger",
"success": "btn-success",
},
"actions_sticky_top": False,
}

37
config/conf/jwt.py Executable file
View File

@@ -0,0 +1,37 @@
from datetime import timedelta
from common.env import env
SIMPLE_JWT = {
"ACCESS_TOKEN_LIFETIME": timedelta(days=30),
"REFRESH_TOKEN_LIFETIME": timedelta(days=365),
"ROTATE_REFRESH_TOKENS": False,
"BLACKLIST_AFTER_ROTATION": False,
"UPDATE_LAST_LOGIN": False,
"ALGORITHM": "HS256",
"SIGNING_KEY": env("DJANGO_SECRET_KEY"),
"VERIFYING_KEY": "",
"AUDIENCE": None,
"ISSUER": None,
"JSON_ENCODER": None,
"JWK_URL": None,
"LEEWAY": 0,
"AUTH_HEADER_TYPES": ("Bearer",),
"AUTH_HEADER_NAME": "HTTP_AUTHORIZATION",
"USER_ID_FIELD": "id",
"USER_ID_CLAIM": "user_id",
"USER_AUTHENTICATION_RULE": "rest_framework_simplejwt.authentication.default_user_authentication_rule",
"AUTH_TOKEN_CLASSES": ("rest_framework_simplejwt.tokens.AccessToken",),
"TOKEN_TYPE_CLAIM": "token_type",
"TOKEN_USER_CLASS": "rest_framework_simplejwt.models.TokenUser",
"JTI_CLAIM": "jti",
"SLIDING_TOKEN_REFRESH_EXP_CLAIM": "refresh_exp",
"SLIDING_TOKEN_LIFETIME": timedelta(days=30),
"SLIDING_TOKEN_REFRESH_LIFETIME": timedelta(days=365),
"TOKEN_OBTAIN_SERIALIZER": "rest_framework_simplejwt.serializers.TokenObtainPairSerializer",
"TOKEN_REFRESH_SERIALIZER": "rest_framework_simplejwt.serializers.TokenRefreshSerializer",
"TOKEN_VERIFY_SERIALIZER": "rest_framework_simplejwt.serializers.TokenVerifySerializer",
"TOKEN_BLACKLIST_SERIALIZER": "rest_framework_simplejwt.serializers.TokenBlacklistSerializer",
"SLIDING_TOKEN_OBTAIN_SERIALIZER": "rest_framework_simplejwt.serializers.TokenObtainSlidingSerializer",
"SLIDING_TOKEN_REFRESH_SERIALIZER": "rest_framework_simplejwt.serializers.TokenRefreshSlidingSerializer",
}

7
config/conf/logs.py Executable file
View File

@@ -0,0 +1,7 @@
import logging
logging.basicConfig(
filename=f"./logs/django.log",
level=logging.DEBUG,
format="%(asctime)s - %(levelname)s - %(message)s",
)

5
config/conf/rest_framework.py Executable file
View File

@@ -0,0 +1,5 @@
REST_FRAMEWORK = {
"DEFAULT_AUTHENTICATION_CLASSES": (
"rest_framework_simplejwt.authentication.JWTAuthentication",
),
}

0
config/settings/__init__.py Executable file
View File

146
config/settings/common.py Executable file
View File

@@ -0,0 +1,146 @@
import os # noqa
import pathlib
import firebase_admin
from django.utils.translation import gettext_lazy as _
from firebase_admin import credentials
from config.conf import * # noqa
BASE_DIR = pathlib.Path(__file__).resolve().parent.parent.parent
SECRET_KEY = env.str("DJANGO_SECRET_KEY")
DEBUG = env.str("DEBUG")
ALLOWED_HOSTS = ["*"]
INSTALLED_APPS = [
# Design admin panel
"jazzmin",
"django_select2",
"modeltranslation",
# Default apps
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
]
INSTALLED_APPS += apps.INSTALLED_APPS # noqa
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"corsheaders.middleware.CorsMiddleware", # Cors middleware
"django.middleware.locale.LocaleMiddleware", # Locale middleware
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"core.middlewares.fcm_token.JWTFCMMiddleware", # FCM Token middleware
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]
ROOT_URLCONF = "routes"
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [os.path.join(BASE_DIR, "resources/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"
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",
},
]
TIME_ZONE = "Asia/Tashkent"
USE_I18N = True
USE_TZ = True
STATIC_URL = "static/"
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
# Date formats
##
DATE_FORMAT = "d.m.y"
TIME_FORMAT = "H:i:s"
DATE_INPUT_FORMATS = ["%d.%m.%Y", "%Y.%d.%m", "%Y.%d.%m"]
FACTORYS = [
("core.http.database.factory.PostFactory", 100000),
# ("core.http.database.factory.UserFactory", 1),
]
SEEDERS = ["core.http.database.seeder.UserSeeder"]
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "resources/static"),
]
CORS_ORIGIN_ALLOW_ALL = True
PAYCOM_SETTINGS = {
"KASSA_ID": "1111",
"ACCOUNTS": {
"KEY": "1234",
},
"TOKEN": "1111",
}
STATIC_ROOT = os.path.join(BASE_DIR, "resources/staticfiles")
VITE_APP_DIR = os.path.join(BASE_DIR, "resources/static/vite")
LANGUAGES = (
("ru", _("Russia")),
("en", _("English")),
("uz", _("Uzbek")),
)
LOCALE_PATHS = [os.path.join(BASE_DIR, "locale")]
MODELTRANSLATION_LANGUAGES = ("uz", "ru", "en")
MODELTRANSLATION_DEFAULT_LANGUAGE = "uz"
LANGUAGE_CODE = "uz"
MEDIA_ROOT = os.path.join(BASE_DIR, "media") # Media files
MEDIA_URL = "/media/"
AUTH_USER_MODEL = "http.User"
CELERY_BROKER_URL = env("REDIS_URL")
CELERY_RESULT_BACKEND = env("REDIS_URL")
CRISPY_TEMPLATE_PACK = "tailwind"
ALLOWED_HOSTS += env("ALLOWED_HOSTS").split(",")
CSRF_TRUSTED_ORIGINS = env("CSRF_TRUSTED_ORIGINS").split(",")
cred = credentials.Certificate("resources/firebase_golden.json")
firebase_admin.initialize_app(cred)

47
config/settings/local.py Executable file
View File

@@ -0,0 +1,47 @@
import core.apps.accounts.apps
from common.env import env
from config.conf import rest_framework
from config.settings.common import * # noqa
DATABASES = {
"default": {
"ENGINE": env.str("DB_ENGINE"),
"NAME": env.str("DB_NAME"),
"USER": env.str("DB_USER"),
"PASSWORD": env.str("DB_PASSWORD"),
"HOST": env.str("DB_HOST"),
"PORT": env.str("DB_PORT"),
}
}
MIDDLEWARE += [
"debug_toolbar.middleware.DebugToolbarMiddleware",
"core.middlewares.ExceptionMiddleware",
]
# Debug toolbar middleware
DEBUG_TOOLBAR_PANELS = [
"debug_toolbar.panels.versions.VersionsPanel",
"debug_toolbar.panels.timer.TimerPanel",
"debug_toolbar.panels.settings.SettingsPanel",
"debug_toolbar.panels.headers.HeadersPanel",
"debug_toolbar.panels.request.RequestPanel",
"debug_toolbar.panels.sql.SQLPanel",
"debug_toolbar.panels.staticfiles.StaticFilesPanel",
"debug_toolbar.panels.templates.TemplatesPanel",
"debug_toolbar.panels.cache.CachePanel",
"debug_toolbar.panels.signals.SignalsPanel",
"debug_toolbar.panels.logging.LoggingPanel",
"debug_toolbar.panels.redirects.RedirectsPanel",
]
INTERNAL_IPS = ("127.0.0.1",)
INSTALLED_APPS += ["debug_toolbar", "django_extensions"]
# Allowed Hosts
ALLOWED_HOSTS += ["127.0.0.1", "192.168.100.26"]
rest_framework.REST_FRAMEWORK["DEFAULT_THROTTLE_RATES"] = {
"user": "10/min",
}

22
config/settings/production.py Executable file
View File

@@ -0,0 +1,22 @@
from common.env import env
from config.conf import rest_framework
from config.settings.common import * # noqa
DATABASES = {
"default": {
"ENGINE": env("DB_ENGINE"),
"NAME": env("DB_NAME"),
"USER": env("DB_USER"),
"PASSWORD": env("DB_PASSWORD"),
"HOST": env("DB_HOST"),
"PORT": env("DB_PORT"),
}
}
MIDDLEWARE += []
ALLOWED_HOSTS += ["192.168.100.26", "80.90.178.156"]
rest_framework.REST_FRAMEWORK["DEFAULT_THROTTLE_RATES"] = {
"user": "10/min",
}

9
config/wsgi.py Executable file
View File

@@ -0,0 +1,9 @@
import os
from django.core.wsgi import get_wsgi_application
from common.env import env
os.environ.setdefault("DJANGO_SETTINGS_MODULE", env("DJANGO_SETTINGS_MODULE"))
application = get_wsgi_application()