Skip to content

Commit b44a0c2

Browse files
delsimdelsim
and
delsim
authored
Enable use of Django 4.x and drop versions earlier than 3.2 (#455)
* Enable use of Django 4.x and drop versions earlier than 3.2 * Remove whitenoise use * Added autofield * Add frozen package list --------- Co-authored-by: delsim <[email protected]>
1 parent f3c880e commit b44a0c2

12 files changed

+98
-88
lines changed

CONTRIBUTIONS.md

+2
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,5 @@ Thanks to the following people:
5555
[deniskristak](https://github.com/deniskristak)
5656

5757
[rnestler](https://github.com/rnestler)
58+
59+
[radusuciu](https://github.com/radusuciu)

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ database:
5252

5353
./manage.py migrate
5454

55-
If using version 3.0 or later of Django, then the use of frames within
55+
The use of frames within
5656
HTML documents has to be enabled by adding to the ``settings.py`` file:
5757

5858
X_FRAME_OPTIONS = 'SAMEORIGIN'

demo/demo/settings.py

-4
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@
4848
MIDDLEWARE = [
4949
'django.middleware.security.SecurityMiddleware',
5050

51-
'whitenoise.middleware.WhiteNoiseMiddleware',
52-
5351
'django.contrib.sessions.middleware.SessionMiddleware',
5452
'django.middleware.common.CommonMiddleware',
5553
'django.middleware.csrf.CsrfViewMiddleware',
@@ -125,8 +123,6 @@
125123

126124
USE_I18N = True
127125

128-
USE_L10N = True
129-
130126
USE_TZ = True
131127

132128
# Plotly dash settings

demo/demo/urls.py

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
from django.contrib import admin
2020
from django.urls import include, path
21-
from django.conf.urls import url
2221

2322
from django.views.generic import TemplateView
2423

dev_requirements.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ coveralls>=1.6.0
44
channels-redis
55
daphne
66
dash-bootstrap-components
7+
dash_mantine_components
78
django-bootstrap4
89
django-redis
910
dpd-static-support>=0.0.4
@@ -21,5 +22,3 @@ sphinx
2122
sphinx-autobuild
2223
sphinx_rtd_theme
2324
twine
24-
whitenoise
25-

django_plotly_dash/apps.py

+1
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ class DjangoPlotlyDashConfig(AppConfig):
2929
'Verbose name and other settings for the django-plotly-dash application'
3030
name = 'django_plotly_dash'
3131
verbose_name = "Django Plotly Dash"
32+
default_auto_field = 'django.db.models.AutoField'

django_plotly_dash/routing.py

+18-6
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,37 @@
2424

2525
from channels.routing import ProtocolTypeRouter, URLRouter
2626
from channels.auth import AuthMiddlewareStack
27-
from channels.http import AsgiHandler
2827

29-
from django.conf.urls import url
3028
from django.urls import re_path
3129

3230
from .consumers import MessageConsumer, PokePipeConsumer
3331
from .util import pipe_ws_endpoint_name, http_endpoint, http_poke_endpoint_enabled
3432

33+
try:
34+
from channels.http import AsgiHandler
35+
OLDER_CHANNELS = True
36+
except:
37+
from django.core.asgi import get_asgi_application
38+
OLDER_CHANNELS = False
39+
40+
3541
# TODO document this and discuss embedding with other routes
3642

3743
http_routes = [
3844
]
3945

46+
4047
if http_poke_endpoint_enabled():
41-
http_routes.append(re_path(http_endpoint("poke"), PokePipeConsumer))
48+
http_routes.append(re_path(http_endpoint("poke"), PokePipeConsumer if OLDER_CHANNELS else PokePipeConsumer.as_asgi()))
49+
50+
51+
if OLDER_CHANNELS:
52+
http_routes.append(re_path("^", AsgiHandler)) # AsgiHandler is 'the normal Django view handlers'
53+
else:
54+
http_routes.append(re_path("^", get_asgi_application()))
4255

43-
http_routes.append(re_path("^", AsgiHandler)) # AsgiHandler is 'the normal Django view handlers'
4456

4557
application = ProtocolTypeRouter({
46-
'websocket': AuthMiddlewareStack(URLRouter([re_path(pipe_ws_endpoint_name(), MessageConsumer),])),
58+
'websocket': AuthMiddlewareStack(URLRouter([re_path(pipe_ws_endpoint_name(), MessageConsumer if OLDER_CHANNELS else MessageConsumer.as_asgi()),])),
4759
'http': AuthMiddlewareStack(URLRouter(http_routes)),
48-
})
60+
})

django_plotly_dash/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323
2424
'''
2525

26-
__version__ = "2.1.4"
26+
__version__ = "2.2.0"

docs/installation.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Installation
44
============
55

6-
The package requires version 2.2 or greater of Django, and a minimum Python version needed of 3.8.
6+
The package requires version 3.2 or greater of Django, and a minimum Python version needed of 3.8.
77

88
Use ``pip`` to install the package, preferably to a local ``virtualenv``::
99

frozen_dev.txt

+71-70
Original file line numberDiff line numberDiff line change
@@ -1,119 +1,120 @@
1-
alabaster==0.7.12
2-
asgiref==3.5.2
3-
astroid==2.12.12
1+
alabaster==0.7.13
2+
asgiref==3.6.0
3+
astroid==2.15.4
44
async-timeout==4.0.2
5-
attrs==22.1.0
6-
autobahn==22.7.1
5+
attrs==23.1.0
6+
autobahn==23.1.2
77
Automat==22.10.0
8-
Babel==2.11.0
9-
beautifulsoup4==4.11.1
10-
bleach==5.0.1
11-
certifi==2022.9.24
8+
Babel==2.12.1
9+
beautifulsoup4==4.12.2
10+
bleach==6.0.0
11+
blinker==1.6.2
12+
certifi==2022.12.7
1213
cffi==1.15.1
13-
channels==2.4.0
14-
channels-redis==4.0.0
15-
charset-normalizer==2.1.1
14+
channels==4.0.0
15+
channels-redis==4.1.0
16+
charset-normalizer==3.1.0
1617
click==8.1.3
1718
colorama==0.4.6
18-
commonmark==0.9.1
1919
constantly==15.1.0
2020
coverage==6.5.0
2121
coveralls==3.3.1
22-
cryptography==38.0.3
23-
daphne==2.5.0
24-
dash==2.7.0
25-
dash-bootstrap-components==1.2.1
22+
cryptography==40.0.2
23+
daphne==4.0.0
24+
dash==2.9.3
25+
dash-bootstrap-components==1.4.1
2626
dash-core-components==2.0.0
2727
dash-html-components==2.0.0
28-
dash-mantine-components==0.11.1
28+
dash-mantine-components==0.12.1
2929
dash-table==5.0.0
30-
Deprecated==1.2.13
3130
dill==0.3.6
32-
Django==3.2.17
33-
django-bootstrap4==22.2
34-
django-plotly-dash==2.1.3
31+
Django==4.2
32+
django-bootstrap4==23.1
33+
-e git+ssh://[email protected]/delsim/django-plotly-dash.git@78c0e85d3b06197601ee966ecae24cdc6bfc29ee#egg=django_plotly_dash
3534
django-redis==5.2.0
3635
docopt==0.6.2
37-
docutils==0.17.1
36+
docutils==0.18.1
3837
dpd-components==0.1.0
3938
dpd-static-support==0.0.5
40-
exceptiongroup==1.0.1
41-
Flask==2.2.2
39+
exceptiongroup==1.1.1
40+
Flask==2.3.2
4241
grip==4.6.1
4342
hyperlink==21.0.0
4443
idna==3.4
4544
imagesize==1.4.1
46-
importlib-metadata==5.0.0
45+
importlib-metadata==6.6.0
4746
incremental==22.10.0
48-
iniconfig==1.1.1
49-
isort==5.10.1
47+
iniconfig==2.0.0
48+
isort==5.12.0
5049
itsdangerous==2.1.2
5150
jaraco.classes==3.2.3
5251
jeepney==0.8.0
5352
Jinja2==3.1.2
54-
keyring==23.11.0
55-
lazy-object-proxy==1.8.0
53+
keyring==23.13.1
54+
lazy-object-proxy==1.9.0
5655
livereload==2.6.3
57-
Markdown==3.4.1
58-
MarkupSafe==2.1.1
56+
Markdown==3.4.3
57+
markdown-it-py==2.2.0
58+
MarkupSafe==2.1.2
5959
mccabe==0.7.0
60-
more-itertools==9.0.0
61-
msgpack==1.0.4
62-
numpy==1.23.4
63-
packaging==21.3
64-
pandas==1.5.1
60+
mdurl==0.1.2
61+
more-itertools==9.1.0
62+
msgpack==1.0.5
63+
numpy==1.24.3
64+
packaging==23.1
65+
pandas==2.0.1
6566
path-and-address==2.0.1
66-
pkginfo==1.8.3
67-
platformdirs==2.5.3
68-
plotly==5.11.0
67+
pkginfo==1.9.6
68+
platformdirs==3.5.0
69+
plotly==5.14.1
6970
pluggy==1.0.0
70-
pyasn1==0.4.8
71-
pyasn1-modules==0.2.8
71+
pyasn1==0.5.0
72+
pyasn1-modules==0.3.0
7273
pycparser==2.21
73-
Pygments==2.13.0
74-
pylint==2.15.5
75-
pyOpenSSL==22.1.0
76-
pyparsing==3.0.9
77-
pytest==7.2.0
74+
Pygments==2.15.1
75+
pylint==2.17.3
76+
pyOpenSSL==23.1.1
77+
pytest==7.3.1
7878
pytest-cov==4.0.0
7979
pytest-django==4.5.2
8080
python-coveralls==2.9.3
8181
python-dateutil==2.8.2
82-
pytz==2022.6
82+
pytz==2023.3
8383
PyYAML==6.0
8484
readme-renderer==37.3
85-
redis==4.3.4
86-
requests==2.28.1
87-
requests-toolbelt==0.10.1
85+
redis==4.5.4
86+
requests==2.29.0
87+
requests-toolbelt==1.0.0
8888
rfc3986==2.0.0
89-
rich==12.6.0
89+
rich==13.3.5
9090
SecretStorage==3.3.3
9191
service-identity==21.1.0
9292
six==1.16.0
9393
snowballstemmer==2.2.0
94-
soupsieve==2.3.2.post1
95-
Sphinx==5.3.0
94+
soupsieve==2.4.1
95+
Sphinx==6.2.1
9696
sphinx-autobuild==2021.3.14
97-
sphinx-rtd-theme==1.1.1
98-
sphinxcontrib-applehelp==1.0.2
97+
sphinx-rtd-theme==1.2.0
98+
sphinxcontrib-applehelp==1.0.4
9999
sphinxcontrib-devhelp==1.0.2
100-
sphinxcontrib-htmlhelp==2.0.0
100+
sphinxcontrib-htmlhelp==2.0.1
101+
sphinxcontrib-jquery==4.1
101102
sphinxcontrib-jsmath==1.0.1
102103
sphinxcontrib-qthelp==1.0.3
103104
sphinxcontrib-serializinghtml==1.1.5
104-
sqlparse==0.4.3
105-
tenacity==8.1.0
105+
sqlparse==0.4.4
106+
tenacity==8.2.2
106107
tomli==2.0.1
107-
tomlkit==0.11.6
108-
tornado==6.2
109-
twine==4.0.1
108+
tomlkit==0.11.8
109+
tornado==6.3.1
110+
twine==4.0.2
110111
Twisted==22.10.0
111-
txaio==22.2.1
112-
typing_extensions==4.4.0
113-
urllib3==1.26.12
112+
txaio==23.1.1
113+
typing_extensions==4.5.0
114+
tzdata==2023.3
115+
urllib3==1.26.15
114116
webencodings==0.5.1
115-
Werkzeug==2.2.2
116-
whitenoise==6.2.0
117-
wrapt==1.14.1
118-
zipp==3.10.0
119-
zope.interface==5.5.1
117+
Werkzeug==2.3.3
118+
wrapt==1.15.0
119+
zipp==3.15.0
120+
zope.interface==6.0

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ dpd-components
55
dash-bootstrap-components
66

77
channels>=2.0
8-
Django>=2.2,<4.0.0
8+
Django>=3.2,<5.0.0
99
Flask>=1.0.2
1010
Werkzeug

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
'dash-bootstrap-components',
4848

4949
'channels>=2.0',
50-
'Django>=2.2,<4.0.0',
50+
'Django>=3.2,<5.0.0',
5151
'Flask>=1.0.2',
5252
'Werkzeug',
5353
],

0 commit comments

Comments
 (0)