add backend base to the project
This commit is contained in:
@@ -0,0 +1,27 @@
|
|||||||
|
### keep the env name to .env.local if you want to change this .env name you should change it in django setting too when you load this env
|
||||||
|
|
||||||
|
DEBUG = True # keep debug true to set the database to sqlite
|
||||||
|
# postgres database info
|
||||||
|
DB_NAME = ''
|
||||||
|
DB_USER = ''
|
||||||
|
DB_PASSWORD = ''
|
||||||
|
DB_HOST = ''
|
||||||
|
DB_PORT = ''
|
||||||
|
SECRET_KEY = '2h&gmi54wqauwqht48l-9c)r6_67_(oe_$ll%(+xz%u#)+of@d'
|
||||||
|
# email stuff
|
||||||
|
EMAIL_BACKEND = ''
|
||||||
|
EMAIL_HOST = ''
|
||||||
|
EMAIL_HOST_USER = ''
|
||||||
|
EMAIL_HOST_PASSWORD = ''
|
||||||
|
DEFAULT_FROM_EMAIL = ''
|
||||||
|
# telegram bot toekn
|
||||||
|
TELEGRAM_BOT_TOKEN = ''
|
||||||
|
# domain for allowed host and allowed cors
|
||||||
|
DOMAIN = ''
|
||||||
|
# domain for api (the domain that django will use)
|
||||||
|
API_DOMAIN = ''
|
||||||
|
SITE_TITLE = ''
|
||||||
|
SITE_HEADER = ''
|
||||||
|
# jwt token configs
|
||||||
|
ACCESS_TOKEN_LIFETIME = 5000
|
||||||
|
REFRESH_TOKEN_LIFETIME = 5000
|
||||||
@@ -0,0 +1,176 @@
|
|||||||
|
# Byte-compiled / optimized / DLL files
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
|
||||||
|
# C extensions
|
||||||
|
*.so
|
||||||
|
|
||||||
|
# Default ignored files
|
||||||
|
/.idea/shelf/
|
||||||
|
/.idea/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/.idea/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/.idea/dataSources/
|
||||||
|
/.idea/dataSources.local.xml
|
||||||
|
|
||||||
|
|
||||||
|
# Distribution / packaging
|
||||||
|
.Python
|
||||||
|
build/
|
||||||
|
develop-eggs/
|
||||||
|
dist/
|
||||||
|
downloads/
|
||||||
|
eggs/
|
||||||
|
.eggs/
|
||||||
|
lib/
|
||||||
|
lib64/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
wheels/
|
||||||
|
share/python-wheels/
|
||||||
|
*.egg-info/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
MANIFEST
|
||||||
|
|
||||||
|
# PyInstaller
|
||||||
|
# Usually these files are written by a python script from a template
|
||||||
|
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||||
|
*.manifest
|
||||||
|
*.spec
|
||||||
|
|
||||||
|
# Installer logs
|
||||||
|
pip-log.txt
|
||||||
|
pip-delete-this-directory.txt
|
||||||
|
|
||||||
|
# Unit test / coverage reports
|
||||||
|
htmlcov/
|
||||||
|
.tox/
|
||||||
|
.nox/
|
||||||
|
.coverage
|
||||||
|
.coverage.*
|
||||||
|
.cache
|
||||||
|
nosetests.xml
|
||||||
|
coverage.xml
|
||||||
|
*.cover
|
||||||
|
*.py,cover
|
||||||
|
.hypothesis/
|
||||||
|
.pytest_cache/
|
||||||
|
cover/
|
||||||
|
|
||||||
|
# Translations
|
||||||
|
*.mo
|
||||||
|
*.pot
|
||||||
|
|
||||||
|
# Django stuff:
|
||||||
|
*.log
|
||||||
|
local_settings.py
|
||||||
|
db.sqlite3
|
||||||
|
db.sqlite3-journal
|
||||||
|
|
||||||
|
# Flask stuff:
|
||||||
|
instance/
|
||||||
|
.webassets-cache
|
||||||
|
|
||||||
|
# Scrapy stuff:
|
||||||
|
.scrapy
|
||||||
|
|
||||||
|
# Sphinx documentation
|
||||||
|
docs/_build/
|
||||||
|
|
||||||
|
# PyBuilder
|
||||||
|
.pybuilder/
|
||||||
|
target/
|
||||||
|
|
||||||
|
# Jupyter Notebook
|
||||||
|
.ipynb_checkpoints
|
||||||
|
|
||||||
|
# IPython
|
||||||
|
profile_default/
|
||||||
|
ipython_config.py
|
||||||
|
|
||||||
|
# pyenv
|
||||||
|
# For a library or package, you might want to ignore these files since the code is
|
||||||
|
# intended to run in multiple environments; otherwise, check them in:
|
||||||
|
# .python-version
|
||||||
|
|
||||||
|
# pipenv
|
||||||
|
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||||
|
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||||
|
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||||
|
# install all needed dependencies.
|
||||||
|
#Pipfile.lock
|
||||||
|
|
||||||
|
# poetry
|
||||||
|
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||||
|
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||||
|
# commonly ignored for libraries.
|
||||||
|
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||||
|
#poetry.lock
|
||||||
|
|
||||||
|
# pdm
|
||||||
|
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||||
|
#pdm.lock
|
||||||
|
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
||||||
|
# in version control.
|
||||||
|
# https://pdm.fming.dev/#use-with-ide
|
||||||
|
.pdm.toml
|
||||||
|
|
||||||
|
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||||
|
__pypackages__/
|
||||||
|
|
||||||
|
# Celery stuff
|
||||||
|
celerybeat-schedule
|
||||||
|
celerybeat.pid
|
||||||
|
|
||||||
|
# SageMath parsed files
|
||||||
|
*.sage.py
|
||||||
|
|
||||||
|
# Environments
|
||||||
|
.env
|
||||||
|
.venv
|
||||||
|
env/
|
||||||
|
venv/
|
||||||
|
ENV/
|
||||||
|
env.bak/
|
||||||
|
venv.bak/
|
||||||
|
|
||||||
|
# Spyder project settings
|
||||||
|
.spyderproject
|
||||||
|
.spyproject
|
||||||
|
|
||||||
|
# Rope project settings
|
||||||
|
.ropeproject
|
||||||
|
|
||||||
|
# mkdocs documentation
|
||||||
|
/site
|
||||||
|
|
||||||
|
# mypy
|
||||||
|
.mypy_cache/
|
||||||
|
.dmypy.json
|
||||||
|
dmypy.json
|
||||||
|
|
||||||
|
# Pyre type checker
|
||||||
|
.pyre/
|
||||||
|
|
||||||
|
# pytype static type analyzer
|
||||||
|
.pytype/
|
||||||
|
|
||||||
|
# Cython debug symbols
|
||||||
|
cython_debug/
|
||||||
|
|
||||||
|
# PyCharm
|
||||||
|
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||||
|
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||||
|
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||||
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
|
#.idea/
|
||||||
|
.idea/.gitignore
|
||||||
|
.idea/ftp-backend.iml
|
||||||
|
.idea/misc.xml
|
||||||
|
.idea/modules.xml
|
||||||
|
.idea/vcs.xml
|
||||||
|
.idea/inspectionProfiles/profiles_settings.xml
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
"""
|
||||||
|
ASGI config for core 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/5.1/howto/deployment/asgi/
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
from django.core.asgi import get_asgi_application
|
||||||
|
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
|
||||||
|
|
||||||
|
application = get_asgi_application()
|
||||||
@@ -0,0 +1,259 @@
|
|||||||
|
from dotenv import load_dotenv
|
||||||
|
# from http.cookiejar import debug
|
||||||
|
from pathlib import Path
|
||||||
|
from datetime import timedelta
|
||||||
|
import os
|
||||||
|
from django.templatetags.static import static
|
||||||
|
from django.urls import reverse_lazy
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
|
# TODO CREATE A ENV WITH THIS NAME
|
||||||
|
### keep the .env name to .env.local if you want to change this name you should change it in here too when you load this env
|
||||||
|
load_dotenv(".env.local")
|
||||||
|
|
||||||
|
DOMAIN = os.getenv("DOMAIN")
|
||||||
|
API_DOMAIN = os.getenv("API_DOMAIN")
|
||||||
|
|
||||||
|
# TODO update telegram bot token
|
||||||
|
TELEGRAM_BOT_TOKEN = os.getenv("TELEGRAM_BOT_TOKEN")
|
||||||
|
|
||||||
|
# TODO update email bullshit
|
||||||
|
EMAIL_BACKEND = os.getenv("EMAIL_BACKEND")
|
||||||
|
EMAIL_HOST = os.getenv("EMAIL_HOST")
|
||||||
|
EMAIL_PORT = 587
|
||||||
|
EMAIL_USE_TLS = True
|
||||||
|
EMAIL_HOST_USER = os.getenv("EMAIL_HOST_USER")
|
||||||
|
EMAIL_HOST_PASSWORD = os.getenv("EMAIL_HOST_PASSWORD")
|
||||||
|
DEFAULT_FROM_EMAIL = os.getenv("SECRET_KEY")
|
||||||
|
|
||||||
|
SECRET_KEY = os.getenv("SECRET_KEY")
|
||||||
|
DEBUG = os.getenv("DEBUG")
|
||||||
|
# in production lists of allowed hosts and allowed orgins will genrate
|
||||||
|
# in development every host and orgin will be true
|
||||||
|
# in prodcution it will use the postgres info you enterd in .env.local
|
||||||
|
# in development it will use the sqlite
|
||||||
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
|
if not DEBUG:
|
||||||
|
ALLOWED_HOSTS = ['127.0.0.1', 'localhost', DOMAIN, API_DOMAIN]
|
||||||
|
CSRF_TRUSTED_ORIGINS = [
|
||||||
|
f"https://{DOMAIN}",
|
||||||
|
f"http://{DOMAIN}",
|
||||||
|
]
|
||||||
|
CORS_ALLOWED_ORIGINS = [f"https://{API_DOMAIN}", f"http://{API_DOMAIN}",
|
||||||
|
f"http://{DOMAIN}", f"https://{DOMAIN}", ]
|
||||||
|
|
||||||
|
# database postgres
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.postgresql',
|
||||||
|
'NAME': os.getenv("DB_NAME"),
|
||||||
|
'USER': os.getenv("DB_USER"),
|
||||||
|
'PASSWORD': os.getenv("DB_PASSWORD"),
|
||||||
|
'HOST': os.getenv("DB_HOST"),
|
||||||
|
'PORT': os.getenv("DB_PORT"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
CORS_ALLOW_ALL_ORIGINS = True
|
||||||
|
# sqlite database
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
|
'NAME': BASE_DIR / 'db.sqlite3',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Application definition
|
||||||
|
|
||||||
|
INSTALLED_APPS = [
|
||||||
|
# unfold theme
|
||||||
|
"unfold",
|
||||||
|
"unfold.contrib.filters",
|
||||||
|
"unfold.contrib.forms",
|
||||||
|
"unfold.contrib.inlines",
|
||||||
|
"unfold.contrib.import_export",
|
||||||
|
"unfold.contrib.guardian",
|
||||||
|
"unfold.contrib.simple_history",
|
||||||
|
# django
|
||||||
|
'django.contrib.admin',
|
||||||
|
'django.contrib.auth',
|
||||||
|
'django.contrib.contenttypes',
|
||||||
|
'django.contrib.sessions',
|
||||||
|
'django.contrib.messages',
|
||||||
|
'django.contrib.staticfiles',
|
||||||
|
# thired party apps
|
||||||
|
'corsheaders',
|
||||||
|
'rest_framework',
|
||||||
|
'drf_spectacular',
|
||||||
|
'django_cleanup.apps.CleanupConfig',
|
||||||
|
'django_filters',
|
||||||
|
'rest_framework_simplejwt',
|
||||||
|
'rest_framework_simplejwt.token_blacklist',
|
||||||
|
'rest_framework.authtoken',
|
||||||
|
'djoser',
|
||||||
|
]
|
||||||
|
|
||||||
|
MIDDLEWARE = [
|
||||||
|
"whitenoise.middleware.WhiteNoiseMiddleware",
|
||||||
|
'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',
|
||||||
|
]
|
||||||
|
|
||||||
|
ROOT_URLCONF = 'core.urls'
|
||||||
|
|
||||||
|
TEMPLATES = [
|
||||||
|
{
|
||||||
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||||
|
'DIRS': [],
|
||||||
|
'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 = 'core.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',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
LANGUAGE_CODE = 'en-us'
|
||||||
|
|
||||||
|
TIME_ZONE = 'UTC'
|
||||||
|
|
||||||
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = True
|
||||||
|
|
||||||
|
STATIC_URL = '/static/'
|
||||||
|
STATIC_ROOT = BASE_DIR / "staticfiles"
|
||||||
|
|
||||||
|
MEDIA_URL = '/media/'
|
||||||
|
MEDIA_ROOT = BASE_DIR / 'media'
|
||||||
|
|
||||||
|
STATICFILES_DIRS = [
|
||||||
|
os.path.join(BASE_DIR, 'static'),
|
||||||
|
]
|
||||||
|
|
||||||
|
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||||
|
|
||||||
|
# AUTH_USER_MODEL = 'accounts.User'
|
||||||
|
|
||||||
|
|
||||||
|
REST_FRAMEWORK = {
|
||||||
|
# 'DEFAULT_FILTER_BACKENDS': ['django_filters.rest_framework.DjangoFilterBackend'],
|
||||||
|
'DEFAULT_RENDERER_CLASSES': [
|
||||||
|
'rest_framework.renderers.JSONRenderer',
|
||||||
|
'rest_framework.renderers.BrowsableAPIRenderer',
|
||||||
|
|
||||||
|
],
|
||||||
|
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||||
|
|
||||||
|
'rest_framework_simplejwt.authentication.JWTAuthentication',
|
||||||
|
|
||||||
|
),
|
||||||
|
'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema',
|
||||||
|
# 'DEFAULT_PERMISSION_CLASSES': [
|
||||||
|
# 'rest_framework.permissions.IsAuthenticated',
|
||||||
|
# ],
|
||||||
|
}
|
||||||
|
|
||||||
|
SIMPLE_JWT = {
|
||||||
|
'ACCESS_TOKEN_LIFETIME': timedelta(days=int(os.getenv("ACCESS_TOKEN_LIFETIME"))),
|
||||||
|
'REFRESH_TOKEN_LIFETIME': timedelta(days=int(os.getenv("REFRESH_TOKEN_LIFETIME"))),
|
||||||
|
'ROTATE_REFRESH_TOKENS': True,
|
||||||
|
'BLACKLIST_AFTER_ROTATION': True,
|
||||||
|
}
|
||||||
|
|
||||||
|
SPECTACULAR_SETTINGS = {
|
||||||
|
'TITLE': os.getenv("SITE_TITLE"),
|
||||||
|
'DESCRIPTION': os.getenv("SITE_TITLE"),
|
||||||
|
'VERSION': '1.0.0',
|
||||||
|
'SERVE_INCLUDE_SCHEMA': False,
|
||||||
|
'COMPONENT_SPLIT_REQUEST': True
|
||||||
|
}
|
||||||
|
|
||||||
|
UNFOLD = {
|
||||||
|
"SITE_TITLE": os.getenv("SITE_TITLE"),
|
||||||
|
"SITE_HEADER": os.getenv("SITE_HEADER"),
|
||||||
|
"SITE_URL": DOMAIN,
|
||||||
|
"SITE_SYMBOL": "shield_person",
|
||||||
|
"SITE_FAVICONS": [
|
||||||
|
{
|
||||||
|
"rel": "icon",
|
||||||
|
"sizes": "32x32",
|
||||||
|
"type": "image/svg+xml",
|
||||||
|
"href": lambda request: static("favicon.svg"),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"SHOW_HISTORY": True,
|
||||||
|
"SHOW_VIEW_ON_SITE": True,
|
||||||
|
"ENVIRONMENT": "core.settings.environment_callback",
|
||||||
|
|
||||||
|
"COLORS": {
|
||||||
|
"font": {
|
||||||
|
"subtle-light": "107 114 128",
|
||||||
|
"subtle-dark": "156 163 175",
|
||||||
|
"default-light": "75 85 99",
|
||||||
|
"default-dark": "209 213 219",
|
||||||
|
"important-light": "17 24 39",
|
||||||
|
"important-dark": "243 244 246",
|
||||||
|
},
|
||||||
|
"primary": {
|
||||||
|
"50": "245 250 255",
|
||||||
|
"100": "230 243 254",
|
||||||
|
"200": "180 218 253",
|
||||||
|
"300": "131 193 252",
|
||||||
|
"400": "81 168 251",
|
||||||
|
"500": "31 144 249",
|
||||||
|
"600": "6 118 224",
|
||||||
|
"700": "4 92 174",
|
||||||
|
"800": "3 66 124",
|
||||||
|
"900": "2 39 75",
|
||||||
|
"950": "1 13 25"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"EXTENSIONS": {
|
||||||
|
"modeltranslation": {
|
||||||
|
"flags": {
|
||||||
|
"en": "🇬🇧",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def environment_callback(request):
|
||||||
|
return ["Development", "warning"]
|
||||||
|
|
||||||
|
|
||||||
|
def badge_callback(request):
|
||||||
|
return 3
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
from django.conf.urls.static import static
|
||||||
|
from django.contrib import admin
|
||||||
|
from django.urls import path, include
|
||||||
|
from drf_spectacular.views import SpectacularSwaggerView, SpectacularAPIView
|
||||||
|
from django.conf import settings
|
||||||
|
from rest_framework_simplejwt.views import TokenObtainPairView,TokenRefreshView
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
|
||||||
|
# djoser
|
||||||
|
path('auth/', include('djoser.urls')),
|
||||||
|
path('auth/', include('djoser.urls.jwt')),
|
||||||
|
|
||||||
|
|
||||||
|
path('token/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
|
||||||
|
path('token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
|
||||||
|
path('admin/', admin.site.urls),
|
||||||
|
path('schema/', SpectacularAPIView.as_view(), name='schema'),
|
||||||
|
path('', SpectacularSwaggerView.as_view(url_name='schema'), name='swagger-ui'),
|
||||||
|
]
|
||||||
|
|
||||||
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
|
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
"""
|
||||||
|
WSGI config for core 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/5.1/howto/deployment/wsgi/
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
from django.core.wsgi import get_wsgi_application
|
||||||
|
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
|
||||||
|
|
||||||
|
application = get_wsgi_application()
|
||||||
Executable
+22
@@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
"""Django's command-line utility for administrative tasks."""
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Run administrative tasks."""
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
|
||||||
|
try:
|
||||||
|
from django.core.management import execute_from_command_line
|
||||||
|
except ImportError as exc:
|
||||||
|
raise ImportError(
|
||||||
|
"Couldn't import Django. Are you sure it's installed and "
|
||||||
|
"available on your PYTHONPATH environment variable? Did you "
|
||||||
|
"forget to activate a virtual environment?"
|
||||||
|
) from exc
|
||||||
|
execute_from_command_line(sys.argv)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
aiohappyeyeballs==2.4.0
|
||||||
|
aiohttp==3.10.5
|
||||||
|
aiosignal==1.3.1
|
||||||
|
anyio==4.6.0
|
||||||
|
asgiref==3.8.1
|
||||||
|
attrs==24.2.0
|
||||||
|
certifi==2024.8.30
|
||||||
|
cffi==1.17.1
|
||||||
|
charset-normalizer==3.3.2
|
||||||
|
cryptography==43.0.3
|
||||||
|
defusedxml==0.8.0rc2
|
||||||
|
diff-match-patch==20230430
|
||||||
|
Django==5.1.2
|
||||||
|
django-cleanup==8.1.0
|
||||||
|
django-cors-headers==4.4.0
|
||||||
|
django-dbbackup==4.2.1
|
||||||
|
django-filter==24.3
|
||||||
|
django-import-export==4.1.1
|
||||||
|
django-iranian-cities==1.0.2
|
||||||
|
django-unfold==0.39.0
|
||||||
|
djangorestframework==3.15.2
|
||||||
|
djangorestframework-simplejwt==5.3.1
|
||||||
|
djoser==2.3.1
|
||||||
|
drf-spectacular==0.27.2
|
||||||
|
factory_boy==3.3.1
|
||||||
|
Faker==28.4.1
|
||||||
|
frozenlist==1.4.1
|
||||||
|
geoip2==4.8.0
|
||||||
|
gnupg==2.3.1
|
||||||
|
h11==0.14.0
|
||||||
|
httpagentparser==1.9.5
|
||||||
|
httpcore==1.0.5
|
||||||
|
httpx==0.27.2
|
||||||
|
idna==3.10
|
||||||
|
inflection==0.5.1
|
||||||
|
jalali_core==1.0.0
|
||||||
|
jdatetime==5.0.0
|
||||||
|
jsonschema==4.23.0
|
||||||
|
jsonschema-specifications==2024.10.1
|
||||||
|
maxminddb==2.6.2
|
||||||
|
multidict==6.1.0
|
||||||
|
oauthlib==3.2.2
|
||||||
|
pillow==10.4.0
|
||||||
|
psutil==6.0.0
|
||||||
|
psycopg2-binary==2.9.9
|
||||||
|
pycparser==2.22
|
||||||
|
PyJWT==2.9.0
|
||||||
|
pyTelegramBotAPI==4.23.0
|
||||||
|
python-dateutil==2.9.0.post0
|
||||||
|
python-dotenv==1.0.1
|
||||||
|
python-telegram-bot==21.6
|
||||||
|
python3-openid==3.2.0
|
||||||
|
pytz==2024.2
|
||||||
|
PyYAML==6.0.2
|
||||||
|
referencing==0.35.1
|
||||||
|
requests==2.32.3
|
||||||
|
requests-oauthlib==2.0.0
|
||||||
|
rpds-py==0.20.0
|
||||||
|
setuptools==75.1.0
|
||||||
|
six==1.16.0
|
||||||
|
sniffio==1.3.1
|
||||||
|
social-auth-app-django==5.4.2
|
||||||
|
social-auth-core==4.5.4
|
||||||
|
sqlparse==0.5.1
|
||||||
|
tablib==3.5.0
|
||||||
|
tzdata==2024.1
|
||||||
|
uritemplate==4.1.1
|
||||||
|
urllib3==2.2.3
|
||||||
|
whitenoise==6.7.0
|
||||||
|
yarl==1.11.1
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
from django.core.mail import send_mail
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
from rest_framework.pagination import LimitOffsetPagination
|
||||||
|
|
||||||
|
class StructurePagination(LimitOffsetPagination):
|
||||||
|
default_limit = 10
|
||||||
|
max_limit = 100
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import telebot
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
|
||||||
|
bot = telebot.TeleBot(settings.TELEGRAM_BOT_TOKEN)
|
||||||
|
|
||||||
|
def send_telegram_message(chat_id, message):
|
||||||
|
bot.send_message(chat_id, message)
|
||||||
Reference in New Issue
Block a user