Compare commits

...

3 Commits

Author SHA1 Message Date
f57472f1f3 updated mail 2023-12-07 02:52:24 +03:00
cdec1efdef removed spacy 2023-12-07 02:24:25 +03:00
4dec3867ca minor fixes and updates, removed spacy 2023-12-07 02:22:37 +03:00
12 changed files with 331 additions and 1319 deletions

View File

@ -7,6 +7,7 @@ DJANGO_READ_DOT_ENV_FILE=no
# ------------------------------------------------------------------------------
REDIS_URL=redis://redis:6379/1
REDIS_CACHE=rediscache://redis:6379/1
REDIS_CACHE_URL=redis://redis:6379/1
CELERY_BROKER_URL=redis://redis:6379/0
# Celery

View File

@ -12,7 +12,6 @@ https://git.akarpov.ru/sanspie/akarpov
### installation
```shell
$ poetry install & poetry shell
$ ./spacy_setup.sh
$ python3 manage.py migrate
```

View File

@ -10,8 +10,8 @@ def extract_file_text(file: str) -> str:
try:
rawdata = open(file, "rb").read()
enc = chardet.detect(rawdata)
with open(file, encoding=enc["encoding"]) as file:
text = file.read()
with open(file, encoding=enc["encoding"]) as f:
text = f.read()
except Exception:
return ""

View File

@ -1,7 +1,7 @@
from config.celery_app import app
def get_scheduled_tasks_name() -> [str]:
def get_scheduled_tasks_name() -> list[str]:
i = app.control.inspect()
t = i.scheduled()
all_tasks = []

View File

@ -52,10 +52,6 @@ COPY ./compose/local/django/start /start
RUN sed -i 's/\r$//g' /start
RUN chmod +x /start
COPY ./compose/local/django/spacy_setup /spacy_setup
RUN sed -i 's/\r$//g' /spacy_setup
RUN chmod +x /spacy_setup
COPY ./compose/local/django/start-redirect /start-redirect
RUN sed -i 's/\r$//g' /start-redirect
RUN chmod +x /start-redirect

View File

@ -1,3 +0,0 @@
python -m spacy download en_core_web_lg
python -m spacy download xx_sent_ud_sm
python -m spacy download ru_core_news_lg

View File

@ -7,4 +7,4 @@ set -o nounset
python manage.py migrate auth
python manage.py migrate
python manage.py runserver_plus 0.0.0.0:8000
daphne config.asgi:application --port 8000 --bind 0.0.0.0

View File

@ -54,7 +54,15 @@
# CACHES
# ------------------------------------------------------------------------------
CACHES = {"default": env.cache_url("REDIS_CACHE")}
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": env("REDIS_CACHE_URL", default="redis://localhost:6379/1"),
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
},
}
}
CACHE_MIDDLEWARE_KEY_PREFIX = "cache_middleware"
CACHE_MIDDLEWARE_SECONDS = 0
CACHE_TTL = 60 * 10
@ -308,6 +316,17 @@
# EMAIL
# ------------------------------------------------------------------------------
"""
host: EMAIL_HOST
port: EMAIL_PORT
username: EMAIL_HOST_USER
password: EMAIL_HOST_PASSWORD
use_tls: EMAIL_USE_TLS
use_ssl: EMAIL_USE_SSL
timeout: EMAIL_TIMEOUT
ssl_keyfile: EMAIL_SSL_KEYFILE
ssl_certfile: EMAIL_SSL_CERTFILE
"""
# https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
EMAIL_BACKEND = env(
"DJANGO_EMAIL_BACKEND",
@ -316,11 +335,11 @@
# https://docs.djangoproject.com/en/dev/ref/settings/#email-timeout
EMAIL_TIMEOUT = 5
EMAIL_HOST_PASSWORD = env(
"EMAIL_PASSWORD",
"EMAIL_HOST_PASSWORD",
default="",
)
EMAIL_HOST_USER = env(
"EMAIL_USER",
"EMAIL_HOST_USER",
default="",
)
EMAIL_USE_SSL = env(
@ -328,6 +347,11 @@
default=False,
)
EMAIL_HOST = env("EMAIL_HOST", default="mailhog")
# https://docs.djangoproject.com/en/dev/ref/settings/#email-port
EMAIL_PORT = env("EMAIL_PORT", default="1025")
EMAIL_FROM = env("EMAIL_FROM", default="noreply@akarpov.ru")
# ADMIN
# ------------------------------------------------------------------------------
# Django Admin URL.

View File

@ -15,14 +15,6 @@
ALLOWED_HOSTS = ["*"]
CSRF_TRUSTED_ORIGINS = ["http://127.0.0.1", "https://*.akarpov.ru"]
# EMAIL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#email-host
EMAIL_HOST = env("EMAIL_HOST", default="mailhog")
# https://docs.djangoproject.com/en/dev/ref/settings/#email-port
EMAIL_PORT = env("EMAIL_PORT", default="1025")
EMAIL_FROM = env("EMAIL_FROM", default="noreply@akarpov.ru")
# WhiteNoise
# ------------------------------------------------------------------------------
# http://whitenoise.evans.io/en/latest/django.html#using-whitenoise-in-development

1593
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -95,8 +95,6 @@ yt-dlp = "^2023.7.6"
pytube = "^15.0.0"
urllib3 = ">=1.26"
requests = ">=2.25"
spacy = {extras = ["lookups"], version = "^3.6.1"}
spacy-transformers = "^1.2.5"
extract-msg = "0.28.7"
pytest-factoryboy = "2.3.1"
pytest-xdist = "^3.3.1"