Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
python-version: "3.12"
#cache: pip
#cache-dependency-path: |
# requirements/base.txt
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,7 @@ cython_debug/

# End of https://www.toptal.com/developers/gitignore/api/django

llama3/llama-3.2/*
llama3/llama-3.2/*

# Local vendor dir for one-off translation scripts (deep-translator)
.vendor_trans/
13 changes: 7 additions & 6 deletions compose/local/django/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PYTHON_VERSION=3.11-bullseye
ARG PYTHON_VERSION=3.12-bookworm

# define an alias for the specfic python version used in this file.
FROM python:${PYTHON_VERSION} AS python
Expand All @@ -20,11 +20,8 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
libopenblas-dev \
libomp-dev

# Instalar gcc-10 y g++-10 en Debian Bullseye
RUN apt-get update && \
apt-get install -y gcc-10 g++-10 ninja-build cmake && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 50 && \
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 50 && \
apt-get install -y ninja-build cmake && \
apt-get clean && rm -rf /var/lib/apt/lists/*

# Actualizar pip, setuptools y wheel antes de instalar dependencias
Expand Down Expand Up @@ -55,7 +52,11 @@ ENV BUILD_ENV ${BUILD_ENVIRONMENT}

WORKDIR ${APP_HOME}

RUN sed -i 's/main/main contrib non-free/' /etc/apt/sources.list
RUN if [ -f /etc/apt/sources.list ]; then \
sed -i 's/main/main contrib non-free/' /etc/apt/sources.list; \
elif [ -f /etc/apt/sources.list.d/debian.sources ]; then \
sed -i 's/Components: main/Components: main contrib non-free non-free-firmware/' /etc/apt/sources.list.d/debian.sources; \
fi

# Install required system dependencies
RUN apt-get update && apt-get install --no-install-recommends -y \
Expand Down
8 changes: 6 additions & 2 deletions compose/production/django/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PYTHON_VERSION=3.11-bullseye
ARG PYTHON_VERSION=3.12-bookworm

# define an alias for the specfic python version used in this file.
FROM python:${PYTHON_VERSION} as python
Expand Down Expand Up @@ -44,7 +44,11 @@ WORKDIR ${APP_HOME}
RUN addgroup --system django \
&& adduser --system --ingroup django django

RUN sed -i 's/main/main contrib non-free/' /etc/apt/sources.list
RUN if [ -f /etc/apt/sources.list ]; then \
sed -i 's/main/main contrib non-free/' /etc/apt/sources.list; \
elif [ -f /etc/apt/sources.list.d/debian.sources ]; then \
sed -i 's/Components: main/Components: main contrib non-free non-free-firmware/' /etc/apt/sources.list.d/debian.sources; \
fi

# Install required system dependencies
RUN apt-get update && apt-get install --no-install-recommends -y \
Expand Down
8 changes: 6 additions & 2 deletions compose/production/django/Dockerfile.llama
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PYTHON_VERSION=3.11-bullseye
ARG PYTHON_VERSION=3.12-bookworm

# define an alias for the specfic python version used in this file.
FROM python:${PYTHON_VERSION} as python
Expand Down Expand Up @@ -50,7 +50,11 @@ WORKDIR ${APP_HOME}
RUN addgroup --system django \
&& adduser --system --ingroup django django

RUN sed -i 's/main/main contrib non-free/' /etc/apt/sources.list
RUN if [ -f /etc/apt/sources.list ]; then \
sed -i 's/main/main contrib non-free/' /etc/apt/sources.list; \
elif [ -f /etc/apt/sources.list.d/debian.sources ]; then \
sed -i 's/Components: main/Components: main contrib non-free non-free-firmware/' /etc/apt/sources.list.d/debian.sources; \
fi

# Install required system dependencies
RUN apt-get update && apt-get install --no-install-recommends -y \
Expand Down
1 change: 1 addition & 0 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.postgres",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
Expand Down
4 changes: 4 additions & 0 deletions config/settings/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@

# SECURITY WARNING: define the correct hosts in production!
ALLOWED_HOSTS = ["*"]
CSRF_TRUSTED_ORIGINS = env.list(
"DJANGO_CSRF_TRUSTED_ORIGINS",
default=["https://tools-hml.scielo.org"],
)

EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"

Expand Down
2 changes: 2 additions & 0 deletions config/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
SECRET_KEY = env("DJANGO_SECRET_KEY")
# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
ALLOWED_HOSTS = env.list("DJANGO_ALLOWED_HOSTS", default=["example.com"])
# https://docs.djangoproject.com/en/dev/ref/settings/#csrf-trusted-origins
CSRF_TRUSTED_ORIGINS = env.list("DJANGO_CSRF_TRUSTED_ORIGINS", default=[])

# DATABASES
# ------------------------------------------------------------------------------
Expand Down
18 changes: 10 additions & 8 deletions markup_doc/wagtail_hooks.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
from django.db import transaction
from django.http import HttpResponseRedirect
from django.utils.translation import gettext_lazy as _
from django.template.response import TemplateResponse
from django.templatetags.static import static
from django.urls import path
from django.utils.html import format_html
from django.utils.translation import gettext_lazy as _
from wagtail import hooks
from wagtail.admin import messages
from wagtail_modeladmin.options import ModelAdmin

from wagtail.snippets.models import register_snippet
from wagtail.snippets.views.snippets import (
CreateView,
EditView,
Expand All @@ -20,13 +26,9 @@
ProcessStatus
)

from markup_doc.tasks import get_labels, task_sync_journals_from_api
from wagtail.admin import messages

from wagtail.snippets.models import register_snippet
from django.db import transaction

from markup_doc import views
from markup_doc.sync_api import sync_collection_from_api
from markup_doc.tasks import get_labels, task_sync_journals_from_api, update_xml



Expand Down
29 changes: 11 additions & 18 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
setuptools>=68.2.2,<82
whitenoise==6.6.0 # https://github.com/evansd/whitenoise
redis==5.0.1 # https://github.com/redis/redis-py
celery==5.3.6 # pyup: < 6.0 # https://github.com/celery/celery
Expand All @@ -6,22 +7,19 @@ hiredis==2.2.3 # https://github.com/redis/hiredis-py

# Django
# ------------------------------------------------------------------------------
django==5.0.8
django-environ==0.11.2
djangorestframework==3.15.2
djangorestframework-simplejwt==5.3.1 # https://django-rest-framework-simplejwt.readthedocs.io/en/latest/
django-celery-beat==2.6.0 # https://github.com/celery/django-celery-beat
django_celery_results==2.5.1
django-compressor==4.4 # https://github.com/django-compressor/django-compressor
django==6.0.5
django-environ==0.13.0
djangorestframework==3.17.1
djangorestframework-simplejwt==5.5.1 # https://django-rest-framework-simplejwt.readthedocs.io/en/latest/
django-celery-beat==2.9.0 # https://github.com/celery/django-celery-beat
django_celery_results==2.6.0
django-compressor==4.6.0 # https://github.com/django-compressor/django-compressor

# Wagtail
# ------------------------------------------------------------------------------
wagtail==6.3
wagtail-modeladmin==2.1.0
wagtail-django-recaptcha==2.1.1
wagtailmenus==3.1.9
wagtail-localize==1.8.2
wagtail-autocomplete==0.11.0
wagtail==7.4
wagtail-modeladmin==2.3.0
wagtail-autocomplete==0.12.0

# lxml
# ------------------------------------------------------------------------------
Expand Down Expand Up @@ -55,8 +53,3 @@ python-docx==1.1.2
# huggingface-hub
# ------------------------------------------------------------------------------
huggingface_hub==0.26.1 # https://pypi.org/project/huggingface-hub/

# Python Bindings for llama.cpp
# ------------------------------------------------------------------------------
llama-cpp-python==0.3.14 # https://llama-cpp-python.readthedocs.io/en/latest/

2 changes: 1 addition & 1 deletion requirements/production.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ sentry-sdk[django]==2.5.1 # https://github.com/getsentry/sentry-python
# Django
# ------------------------------------------------------------------------------
django-anymail # https://github.com/anymail/django-anymail
setuptools>=68.2.2 # not directly required, pinned by Snyk to avoid a vulnerability
setuptools>=68.2.2,<82


# Elastic-APM # https://pypi.org/project/elastic-apm/
Expand Down
Loading