Skip to content

Commit 742f249

Browse files
macoloMario Colombo
and
Mario Colombo
authored
support for djangocms-text (#65)
* support for djangocms-text * add --rm to docker compose run commands * Update requirements.txt upgrade djangocms-text * switch Manifest mode on again --------- Co-authored-by: Mario Colombo <mario@what.digital>
1 parent 3ee2915 commit 742f249

File tree

7 files changed

+85
-79
lines changed

7 files changed

+85
-79
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.git
2+
node_modules

Dockerfile

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ FROM python:3.11
22

33
WORKDIR /app
44

5-
COPY . .
6-
75
RUN python -m pip install --upgrade pip
8-
RUN python -m pip install -r requirements.txt
6+
7+
# optimizing the docker caching behaviour
8+
COPY requirements.txt .
9+
RUN python -m pip install --no-cache-dir -r requirements.txt
10+
COPY . .
911

1012
RUN python manage.py collectstatic --noinput
1113

README.rst

+8-4
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ Try it
3535
cd django-cms-quickstart
3636
docker compose build web
3737
docker compose up -d database_default
38-
docker compose run web python manage.py migrate
39-
docker compose run web python manage.py createsuperuser
38+
docker compose run --rm web python manage.py migrate
39+
docker compose run --rm web python manage.py createsuperuser
4040
docker compose up -d
4141
4242
Then open http://django-cms-quickstart.127.0.0.1.nip.io:8000 (or just http://127.0.0.1:8000) in your browser.
@@ -74,8 +74,12 @@ Options are also available for using Postgres/MySQL, uWSGI/Gunicorn/Guvicorn, et
7474
Updating requirements
7575
=====================
7676

77-
The project uses a 2 step approach, freezing all dependencies with pip-tools. Read more about how to handle it here:
78-
https://blog.typodrive.com/2020/02/04/always-freeze-requirements-with-pip-compile-to-avoid-unpleasant-surprises/
77+
The project uses a django best practise two step approach, freezing all dependencies with pip-tools. Here is how to update requirements:
78+
79+
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)
80+
2. Run `docker compose run --rm web pip-compile requirements.in >> requirements.txt`
81+
3. `requirements.txt` should now have changed
82+
4. Rebuild the container `docker compose build web` and restart `docker compose up -d`
7983

8084
Features
8185
########

backend/settings.py

+20-14
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@
5757
'djangocms_alias',
5858
'parler',
5959

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

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

197-
STATIC_URL = '/static/'
198-
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles_collected')
199-
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
200-
201-
# Media files
202-
# DEFAULT_FILE_STORAGE is configured using DEFAULT_STORAGE_DSN
197+
STATICFILES_DIRS = [ # this are were django staticfiles is looking for sources
198+
BASE_DIR / "backend" / "static",
199+
]
203200

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

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

210-
# Django's DEFAULT_FILE_STORAGE requires the class name
211-
DEFAULT_FILE_STORAGE = 'backend.settings.DefaultStorageClass'
209+
STORAGES = {
210+
'default': {
211+
'BACKEND': 'backend.settings.DefaultStorageClass',
212+
},
213+
'staticfiles': {
214+
'BACKEND': 'whitenoise.storage.CompressedManifestStaticFilesStorage',
215+
# 'BACKEND': 'whitenoise.storage.CompressedStaticFilesStorage',
216+
},
217+
}
212218

213219
# only required for local file storage and serving, in development
214220
MEDIA_URL = 'media/'
215-
MEDIA_ROOT = os.path.join('/data/media/')
221+
MEDIA_ROOT = '/data/media/'
216222

217223

218224
SITE_ID = 1

compose.yaml

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: "3"
2-
31
services:
42
web:
53
# the application's web service (container) will use an image based on our Dockerfile
@@ -40,4 +38,4 @@ networks:
4038
djangocmsnet:
4139

4240
volumes:
43-
postgres-data:
41+
postgres-data:

requirements.in

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ boto3
55
psycopg2
66
uwsgi
77

8-
django<5
8+
django<=6
99
dj-database-url
1010
django-storage-url
1111
whitenoise
@@ -19,12 +19,12 @@ djangocms-alias>=2.0.0
1919
# optional, but used in most projects
2020
djangocms-admin-style>=3.2.2
2121

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

2525

2626
# optional django CMS frontend
27-
djangocms-frontend!=1.2.1
27+
djangocms-frontend
2828

2929
django-filer
3030

requirements.txt

+45-51
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
11
#
2-
# This file is autogenerated by pip-compile with Python 3.11
2+
# This file is autogenerated by pip-compile with Python 3.12
33
# by the following command:
44
#
55
# pip-compile --output-file=requirements.txt requirements.in
66
#
7-
asgiref==3.7.2
7+
asgiref==3.8.1
88
# via django
9-
boto3==1.34.11
9+
boto3==1.35.2
1010
# via -r requirements.in
11-
botocore==1.34.11
11+
botocore==1.35.2
1212
# via
1313
# boto3
1414
# s3transfer
15-
build==1.0.3
15+
build==1.2.1
1616
# via pip-tools
1717
chardet==5.2.0
1818
# via reportlab
1919
click==8.1.7
2020
# via pip-tools
2121
cssselect2==0.7.0
2222
# via svglib
23-
dj-database-url==2.1.0
23+
dj-database-url==2.2.0
2424
# via -r requirements.in
25-
django==4.2.8
25+
django==4.2.15
2626
# via
2727
# -r requirements.in
2828
# dj-database-url
29-
# django-appconf
3029
# django-classy-tags
3130
# django-cms
3231
# django-entangled
@@ -35,7 +34,6 @@ django==4.2.8
3534
# django-parler
3635
# django-polymorphic
3736
# django-sekizai
38-
# django-select2
3937
# django-storage-url
4038
# django-storages
4139
# django-treebeard
@@ -44,129 +42,125 @@ django==4.2.8
4442
# djangocms-frontend
4543
# djangocms-versioning
4644
# easy-thumbnails
47-
django-appconf==1.0.6
48-
# via django-select2
4945
django-classy-tags==4.1.0
5046
# via
5147
# django-cms
5248
# django-sekizai
53-
django-cms==4.1.0
49+
django-cms==4.1.2
5450
# via
5551
# -r requirements.in
5652
# djangocms-alias
5753
# djangocms-attributes-field
5854
# djangocms-frontend
59-
# djangocms-text-ckeditor
55+
# djangocms-text
6056
# djangocms-versioning
6157
django-entangled==0.5.4
6258
# via djangocms-frontend
63-
django-filer==3.1.1
59+
django-filer==3.1.4
6460
# via
6561
# -r requirements.in
6662
# djangocms-frontend
6763
django-formtools==2.5.1
6864
# via django-cms
69-
django-fsm==2.8.1
65+
django-fsm==2.8.2
7066
# via djangocms-versioning
7167
django-parler==2.3
7268
# via djangocms-alias
7369
django-polymorphic==3.1.0
7470
# via django-filer
7571
django-sekizai==4.1.0
7672
# via django-cms
77-
django-select2==8.1.2
78-
# via djangocms-frontend
7973
django-storage-url==0.12.0
8074
# via -r requirements.in
81-
django-storages==1.14.2
75+
django-storages==1.14.4
8276
# via django-storage-url
83-
django-treebeard==4.7
77+
django-treebeard==4.7.1
8478
# via django-cms
85-
djangocms-admin-style==3.2.6
79+
djangocms-admin-style==3.3.1
8680
# via
8781
# -r requirements.in
8882
# django-cms
89-
djangocms-alias==2.0.0
83+
djangocms-alias==2.0.1
9084
# via -r requirements.in
9185
djangocms-attributes-field==3.0.0
9286
# via djangocms-frontend
93-
djangocms-frontend==1.2.2
87+
djangocms-frontend==1.3.3
9488
# via -r requirements.in
95-
djangocms-text-ckeditor==5.1.5
96-
# via
97-
# -r requirements.in
98-
# djangocms-frontend
99-
djangocms-versioning==2.0.0
89+
djangocms-text==0.2.2
90+
# via -r requirements.in
91+
djangocms-versioning==2.0.2
10092
# via -r requirements.in
101-
easy-thumbnails[svg]==2.8.5
93+
easy-thumbnails[svg]==2.9
10294
# via
10395
# -r requirements.in
10496
# django-filer
10597
# djangocms-frontend
10698
furl==2.1.3
10799
# via django-storage-url
108-
html5lib==1.1
109-
# via djangocms-text-ckeditor
110100
jmespath==1.0.1
111101
# via
112102
# boto3
113103
# botocore
114-
lxml==5.0.0
115-
# via svglib
104+
lxml==5.3.0
105+
# via
106+
# djangocms-text
107+
# svglib
108+
nh3==0.2.18
109+
# via djangocms-text
116110
orderedmultidict==1.0.1
117111
# via furl
118-
packaging==23.2
112+
packaging==24.1
119113
# via
120114
# build
121115
# django-cms
122-
# djangocms-text-ckeditor
123-
pillow==10.1.0
116+
# djangocms-text
117+
pillow==10.4.0
124118
# via
125-
# djangocms-text-ckeditor
119+
# djangocms-text
126120
# easy-thumbnails
127121
# reportlab
128-
pip-tools==7.3.0
122+
pip-tools==7.4.1
129123
# via -r requirements.in
130124
psycopg2==2.9.9
131125
# via -r requirements.in
132-
pyproject-hooks==1.0.0
133-
# via build
134-
python-dateutil==2.8.2
126+
pyproject-hooks==1.1.0
127+
# via
128+
# build
129+
# pip-tools
130+
python-dateutil==2.9.0.post0
135131
# via botocore
136-
reportlab==4.0.8
132+
reportlab==4.2.2
137133
# via
138134
# easy-thumbnails
139135
# svglib
140-
s3transfer==0.10.0
136+
s3transfer==0.10.2
141137
# via boto3
142138
six==1.16.0
143139
# via
144140
# furl
145-
# html5lib
146141
# orderedmultidict
147142
# python-dateutil
148-
sqlparse==0.4.4
143+
sqlparse==0.5.1
149144
# via django
150145
svglib==1.5.1
151146
# via easy-thumbnails
152-
tinycss2==1.2.1
147+
tinycss2==1.3.0
153148
# via
154149
# cssselect2
155150
# svglib
156-
typing-extensions==4.9.0
151+
typing-extensions==4.12.2
157152
# via dj-database-url
158-
urllib3==2.0.7
153+
urllib3==2.2.2
159154
# via botocore
160-
uwsgi==2.0.23
155+
uwsgi==2.0.26
161156
# via -r requirements.in
162157
webencodings==0.5.1
163158
# via
164159
# cssselect2
165-
# html5lib
166160
# tinycss2
167-
wheel==0.42.0
161+
wheel==0.44.0
168162
# via pip-tools
169-
whitenoise==6.6.0
163+
whitenoise==6.7.0
170164
# via -r requirements.in
171165

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

0 commit comments

Comments
 (0)