Skip to content

Commit

Permalink
support for djangocms-text
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario Colombo committed Aug 20, 2024
1 parent 3ee2915 commit 9a9a4cf
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 77 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.git
node_modules
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ FROM python:3.11

WORKDIR /app

COPY . .

RUN python -m pip install --upgrade pip
RUN python -m pip install -r requirements.txt

# optimizing the docker caching behaviour
COPY requirements.txt .
RUN python -m pip install --no-cache-dir -r requirements.txt
COPY . .

RUN python manage.py collectstatic --noinput

Expand Down
8 changes: 6 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,12 @@ Options are also available for using Postgres/MySQL, uWSGI/Gunicorn/Guvicorn, et
Updating requirements
=====================

The project uses a 2 step approach, freezing all dependencies with pip-tools. Read more about how to handle it here:
https://blog.typodrive.com/2020/02/04/always-freeze-requirements-with-pip-compile-to-avoid-unpleasant-surprises/
The project uses a django best practise two step approach, freezing all dependencies with pip-tools. Here is how to update requirements:

1. Change `requirements.in` according to your needs. There is no need to pin the package versions here unless you have a good reason (i.e. known incompatibilities)
2. Run `docker compose run web pip-compile requirements.in >> requirements.txt`
3. `requirements.txt` should now have changed
4. Rebuild the container `docker compose build web` and restart `docker compose up -d`

Features
########
Expand Down
34 changes: 20 additions & 14 deletions backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
'djangocms_alias',
'parler',

# the default CKEditor - optional, but used in most projects
'djangocms_text_ckeditor',
# the next-gen text editor - optional, but used in most projects
'djangocms_text',

# optional django CMS frontend modules
'djangocms_frontend',
Expand Down Expand Up @@ -194,25 +194,31 @@
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles_collected')
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'

# Media files
# DEFAULT_FILE_STORAGE is configured using DEFAULT_STORAGE_DSN
STATICFILES_DIRS = [ # this are were django staticfiles is looking for sources
BASE_DIR / "backend" / "static",
]

# read the setting value from the environment variable
DEFAULT_STORAGE_DSN = os.environ.get('DEFAULT_STORAGE_DSN')
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles_collected') # this is were the collected files are placed

# dsn_configured_storage_class() requires the name of the setting
# read the setting value from the environment variable. This functionality is
# provided by https://github.com/divio/django-storage-url
DEFAULT_STORAGE_DSN = os.environ.get('DEFAULT_STORAGE_DSN', '/data/media/')
DefaultStorageClass = dsn_configured_storage_class('DEFAULT_STORAGE_DSN')

# Django's DEFAULT_FILE_STORAGE requires the class name
DEFAULT_FILE_STORAGE = 'backend.settings.DefaultStorageClass'
STORAGES = {
'default': {
'BACKEND': 'backend.settings.DefaultStorageClass',
},
'staticfiles': {
# 'BACKEND': 'whitenoise.storage.CompressedManifestStaticFilesStorage',
'BACKEND': 'whitenoise.storage.CompressedStaticFilesStorage',
},
}

# only required for local file storage and serving, in development
MEDIA_URL = 'media/'
MEDIA_ROOT = os.path.join('/data/media/')
MEDIA_ROOT = '/data/media/'


SITE_ID = 1
Expand Down
4 changes: 1 addition & 3 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3"

services:
web:
# the application's web service (container) will use an image based on our Dockerfile
Expand Down Expand Up @@ -40,4 +38,4 @@ networks:
djangocmsnet:

volumes:
postgres-data:
postgres-data:
8 changes: 4 additions & 4 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ boto3
psycopg2
uwsgi

django<5
django<=6
dj-database-url
django-storage-url
whitenoise
Expand All @@ -19,12 +19,12 @@ djangocms-alias>=2.0.0
# optional, but used in most projects
djangocms-admin-style>=3.2.2

# the default CKEditor - optional, but used in most projects
djangocms-text-ckeditor>=5.1.2
# the next-gen text editor
djangocms-text


# optional django CMS frontend
djangocms-frontend!=1.2.1
djangocms-frontend

django-filer

Expand Down
96 changes: 45 additions & 51 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile --output-file=requirements.txt requirements.in
#
asgiref==3.7.2
asgiref==3.8.1
# via django
boto3==1.34.11
boto3==1.35.2
# via -r requirements.in
botocore==1.34.11
botocore==1.35.2
# via
# boto3
# s3transfer
build==1.0.3
build==1.2.1
# via pip-tools
chardet==5.2.0
# via reportlab
click==8.1.7
# via pip-tools
cssselect2==0.7.0
# via svglib
dj-database-url==2.1.0
dj-database-url==2.2.0
# via -r requirements.in
django==4.2.8
django==4.2.15
# via
# -r requirements.in
# dj-database-url
# django-appconf
# django-classy-tags
# django-cms
# django-entangled
Expand All @@ -35,7 +34,6 @@ django==4.2.8
# django-parler
# django-polymorphic
# django-sekizai
# django-select2
# django-storage-url
# django-storages
# django-treebeard
Expand All @@ -44,129 +42,125 @@ django==4.2.8
# djangocms-frontend
# djangocms-versioning
# easy-thumbnails
django-appconf==1.0.6
# via django-select2
django-classy-tags==4.1.0
# via
# django-cms
# django-sekizai
django-cms==4.1.0
django-cms==4.1.2
# via
# -r requirements.in
# djangocms-alias
# djangocms-attributes-field
# djangocms-frontend
# djangocms-text-ckeditor
# djangocms-text
# djangocms-versioning
django-entangled==0.5.4
# via djangocms-frontend
django-filer==3.1.1
django-filer==3.1.4
# via
# -r requirements.in
# djangocms-frontend
django-formtools==2.5.1
# via django-cms
django-fsm==2.8.1
django-fsm==2.8.2
# via djangocms-versioning
django-parler==2.3
# via djangocms-alias
django-polymorphic==3.1.0
# via django-filer
django-sekizai==4.1.0
# via django-cms
django-select2==8.1.2
# via djangocms-frontend
django-storage-url==0.12.0
# via -r requirements.in
django-storages==1.14.2
django-storages==1.14.4
# via django-storage-url
django-treebeard==4.7
django-treebeard==4.7.1
# via django-cms
djangocms-admin-style==3.2.6
djangocms-admin-style==3.3.1
# via
# -r requirements.in
# django-cms
djangocms-alias==2.0.0
djangocms-alias==2.0.1
# via -r requirements.in
djangocms-attributes-field==3.0.0
# via djangocms-frontend
djangocms-frontend==1.2.2
djangocms-frontend==1.3.3
# via -r requirements.in
djangocms-text-ckeditor==5.1.5
# via
# -r requirements.in
# djangocms-frontend
djangocms-versioning==2.0.0
djangocms-text==0.2.1
# via -r requirements.in
djangocms-versioning==2.0.2
# via -r requirements.in
easy-thumbnails[svg]==2.8.5
easy-thumbnails[svg]==2.9
# via
# -r requirements.in
# django-filer
# djangocms-frontend
furl==2.1.3
# via django-storage-url
html5lib==1.1
# via djangocms-text-ckeditor
jmespath==1.0.1
# via
# boto3
# botocore
lxml==5.0.0
# via svglib
lxml==5.3.0
# via
# djangocms-text
# svglib
nh3==0.2.18
# via djangocms-text
orderedmultidict==1.0.1
# via furl
packaging==23.2
packaging==24.1
# via
# build
# django-cms
# djangocms-text-ckeditor
pillow==10.1.0
# djangocms-text
pillow==10.4.0
# via
# djangocms-text-ckeditor
# djangocms-text
# easy-thumbnails
# reportlab
pip-tools==7.3.0
pip-tools==7.4.1
# via -r requirements.in
psycopg2==2.9.9
# via -r requirements.in
pyproject-hooks==1.0.0
# via build
python-dateutil==2.8.2
pyproject-hooks==1.1.0
# via
# build
# pip-tools
python-dateutil==2.9.0.post0
# via botocore
reportlab==4.0.8
reportlab==4.2.2
# via
# easy-thumbnails
# svglib
s3transfer==0.10.0
s3transfer==0.10.2
# via boto3
six==1.16.0
# via
# furl
# html5lib
# orderedmultidict
# python-dateutil
sqlparse==0.4.4
sqlparse==0.5.1
# via django
svglib==1.5.1
# via easy-thumbnails
tinycss2==1.2.1
tinycss2==1.3.0
# via
# cssselect2
# svglib
typing-extensions==4.9.0
typing-extensions==4.12.2
# via dj-database-url
urllib3==2.0.7
urllib3==2.2.2
# via botocore
uwsgi==2.0.23
uwsgi==2.0.26
# via -r requirements.in
webencodings==0.5.1
# via
# cssselect2
# html5lib
# tinycss2
wheel==0.42.0
wheel==0.44.0
# via pip-tools
whitenoise==6.6.0
whitenoise==6.7.0
# via -r requirements.in

# The following packages are considered to be unsafe in a requirements file:
Expand Down

0 comments on commit 9a9a4cf

Please sign in to comment.