Skip to content

Commit

Permalink
Enable use of Django 4.x and drop versions earlier than 3.2 (#455)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
delsim and delsim authored May 3, 2023
1 parent f3c880e commit b44a0c2
Show file tree
Hide file tree
Showing 12 changed files with 98 additions and 88 deletions.
2 changes: 2 additions & 0 deletions CONTRIBUTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,5 @@ Thanks to the following people:
[deniskristak](https://github.com/deniskristak)

[rnestler](https://github.com/rnestler)

[radusuciu](https://github.com/radusuciu)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ database:

./manage.py migrate

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

X_FRAME_OPTIONS = 'SAMEORIGIN'
Expand Down
4 changes: 0 additions & 4 deletions demo/demo/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',

'whitenoise.middleware.WhiteNoiseMiddleware',

'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
Expand Down Expand Up @@ -125,8 +123,6 @@

USE_I18N = True

USE_L10N = True

USE_TZ = True

# Plotly dash settings
Expand Down
1 change: 0 additions & 1 deletion demo/demo/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

from django.contrib import admin
from django.urls import include, path
from django.conf.urls import url

from django.views.generic import TemplateView

Expand Down
3 changes: 1 addition & 2 deletions dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ coveralls>=1.6.0
channels-redis
daphne
dash-bootstrap-components
dash_mantine_components
django-bootstrap4
django-redis
dpd-static-support>=0.0.4
Expand All @@ -21,5 +22,3 @@ sphinx
sphinx-autobuild
sphinx_rtd_theme
twine
whitenoise

1 change: 1 addition & 0 deletions django_plotly_dash/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ class DjangoPlotlyDashConfig(AppConfig):
'Verbose name and other settings for the django-plotly-dash application'
name = 'django_plotly_dash'
verbose_name = "Django Plotly Dash"
default_auto_field = 'django.db.models.AutoField'
24 changes: 18 additions & 6 deletions django_plotly_dash/routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,37 @@

from channels.routing import ProtocolTypeRouter, URLRouter
from channels.auth import AuthMiddlewareStack
from channels.http import AsgiHandler

from django.conf.urls import url
from django.urls import re_path

from .consumers import MessageConsumer, PokePipeConsumer
from .util import pipe_ws_endpoint_name, http_endpoint, http_poke_endpoint_enabled

try:
from channels.http import AsgiHandler
OLDER_CHANNELS = True
except:
from django.core.asgi import get_asgi_application
OLDER_CHANNELS = False


# TODO document this and discuss embedding with other routes

http_routes = [
]


if http_poke_endpoint_enabled():
http_routes.append(re_path(http_endpoint("poke"), PokePipeConsumer))
http_routes.append(re_path(http_endpoint("poke"), PokePipeConsumer if OLDER_CHANNELS else PokePipeConsumer.as_asgi()))


if OLDER_CHANNELS:
http_routes.append(re_path("^", AsgiHandler)) # AsgiHandler is 'the normal Django view handlers'
else:
http_routes.append(re_path("^", get_asgi_application()))

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

application = ProtocolTypeRouter({
'websocket': AuthMiddlewareStack(URLRouter([re_path(pipe_ws_endpoint_name(), MessageConsumer),])),
'websocket': AuthMiddlewareStack(URLRouter([re_path(pipe_ws_endpoint_name(), MessageConsumer if OLDER_CHANNELS else MessageConsumer.as_asgi()),])),
'http': AuthMiddlewareStack(URLRouter(http_routes)),
})
})
2 changes: 1 addition & 1 deletion django_plotly_dash/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
'''

__version__ = "2.1.4"
__version__ = "2.2.0"
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Installation
============

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

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

Expand Down
141 changes: 71 additions & 70 deletions frozen_dev.txt
Original file line number Diff line number Diff line change
@@ -1,119 +1,120 @@
alabaster==0.7.12
asgiref==3.5.2
astroid==2.12.12
alabaster==0.7.13
asgiref==3.6.0
astroid==2.15.4
async-timeout==4.0.2
attrs==22.1.0
autobahn==22.7.1
attrs==23.1.0
autobahn==23.1.2
Automat==22.10.0
Babel==2.11.0
beautifulsoup4==4.11.1
bleach==5.0.1
certifi==2022.9.24
Babel==2.12.1
beautifulsoup4==4.12.2
bleach==6.0.0
blinker==1.6.2
certifi==2022.12.7
cffi==1.15.1
channels==2.4.0
channels-redis==4.0.0
charset-normalizer==2.1.1
channels==4.0.0
channels-redis==4.1.0
charset-normalizer==3.1.0
click==8.1.3
colorama==0.4.6
commonmark==0.9.1
constantly==15.1.0
coverage==6.5.0
coveralls==3.3.1
cryptography==38.0.3
daphne==2.5.0
dash==2.7.0
dash-bootstrap-components==1.2.1
cryptography==40.0.2
daphne==4.0.0
dash==2.9.3
dash-bootstrap-components==1.4.1
dash-core-components==2.0.0
dash-html-components==2.0.0
dash-mantine-components==0.11.1
dash-mantine-components==0.12.1
dash-table==5.0.0
Deprecated==1.2.13
dill==0.3.6
Django==3.2.17
django-bootstrap4==22.2
django-plotly-dash==2.1.3
Django==4.2
django-bootstrap4==23.1
-e git+ssh://[email protected]/delsim/django-plotly-dash.git@78c0e85d3b06197601ee966ecae24cdc6bfc29ee#egg=django_plotly_dash
django-redis==5.2.0
docopt==0.6.2
docutils==0.17.1
docutils==0.18.1
dpd-components==0.1.0
dpd-static-support==0.0.5
exceptiongroup==1.0.1
Flask==2.2.2
exceptiongroup==1.1.1
Flask==2.3.2
grip==4.6.1
hyperlink==21.0.0
idna==3.4
imagesize==1.4.1
importlib-metadata==5.0.0
importlib-metadata==6.6.0
incremental==22.10.0
iniconfig==1.1.1
isort==5.10.1
iniconfig==2.0.0
isort==5.12.0
itsdangerous==2.1.2
jaraco.classes==3.2.3
jeepney==0.8.0
Jinja2==3.1.2
keyring==23.11.0
lazy-object-proxy==1.8.0
keyring==23.13.1
lazy-object-proxy==1.9.0
livereload==2.6.3
Markdown==3.4.1
MarkupSafe==2.1.1
Markdown==3.4.3
markdown-it-py==2.2.0
MarkupSafe==2.1.2
mccabe==0.7.0
more-itertools==9.0.0
msgpack==1.0.4
numpy==1.23.4
packaging==21.3
pandas==1.5.1
mdurl==0.1.2
more-itertools==9.1.0
msgpack==1.0.5
numpy==1.24.3
packaging==23.1
pandas==2.0.1
path-and-address==2.0.1
pkginfo==1.8.3
platformdirs==2.5.3
plotly==5.11.0
pkginfo==1.9.6
platformdirs==3.5.0
plotly==5.14.1
pluggy==1.0.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pyasn1==0.5.0
pyasn1-modules==0.3.0
pycparser==2.21
Pygments==2.13.0
pylint==2.15.5
pyOpenSSL==22.1.0
pyparsing==3.0.9
pytest==7.2.0
Pygments==2.15.1
pylint==2.17.3
pyOpenSSL==23.1.1
pytest==7.3.1
pytest-cov==4.0.0
pytest-django==4.5.2
python-coveralls==2.9.3
python-dateutil==2.8.2
pytz==2022.6
pytz==2023.3
PyYAML==6.0
readme-renderer==37.3
redis==4.3.4
requests==2.28.1
requests-toolbelt==0.10.1
redis==4.5.4
requests==2.29.0
requests-toolbelt==1.0.0
rfc3986==2.0.0
rich==12.6.0
rich==13.3.5
SecretStorage==3.3.3
service-identity==21.1.0
six==1.16.0
snowballstemmer==2.2.0
soupsieve==2.3.2.post1
Sphinx==5.3.0
soupsieve==2.4.1
Sphinx==6.2.1
sphinx-autobuild==2021.3.14
sphinx-rtd-theme==1.1.1
sphinxcontrib-applehelp==1.0.2
sphinx-rtd-theme==1.2.0
sphinxcontrib-applehelp==1.0.4
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-htmlhelp==2.0.1
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
sqlparse==0.4.3
tenacity==8.1.0
sqlparse==0.4.4
tenacity==8.2.2
tomli==2.0.1
tomlkit==0.11.6
tornado==6.2
twine==4.0.1
tomlkit==0.11.8
tornado==6.3.1
twine==4.0.2
Twisted==22.10.0
txaio==22.2.1
typing_extensions==4.4.0
urllib3==1.26.12
txaio==23.1.1
typing_extensions==4.5.0
tzdata==2023.3
urllib3==1.26.15
webencodings==0.5.1
Werkzeug==2.2.2
whitenoise==6.2.0
wrapt==1.14.1
zipp==3.10.0
zope.interface==5.5.1
Werkzeug==2.3.3
wrapt==1.15.0
zipp==3.15.0
zope.interface==6.0
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ dpd-components
dash-bootstrap-components

channels>=2.0
Django>=2.2,<4.0.0
Django>=3.2,<5.0.0
Flask>=1.0.2
Werkzeug
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
'dash-bootstrap-components',

'channels>=2.0',
'Django>=2.2,<4.0.0',
'Django>=3.2,<5.0.0',
'Flask>=1.0.2',
'Werkzeug',
],
Expand Down

0 comments on commit b44a0c2

Please sign in to comment.