Skip to content

Commit

Permalink
Updates to fix Django examples with Bokeh 2.0.2 (#1290)
Browse files Browse the repository at this point in the history
* Updates to fix Django examples with Bokeh 2.0.2

* Update docs
  • Loading branch information
philippjfr authored Apr 24, 2020
1 parent 5a3a6ee commit 1df70b5
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 14 deletions.
5 changes: 0 additions & 5 deletions examples/apps/django2/project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# These are required to connect bokeh
'channels',
'bokeh.server.django',
Expand Down Expand Up @@ -122,7 +121,3 @@
STATIC_URL = '/static/'

STATICFILES_DIRS = [bokehjsdir()]

# Ensure that bokeh resources are loaded from CDN
# (loading from server broken as of Bokeh 2.0.1 so only CDN and INLINE will work)
settings.resources = 'cdn'
3 changes: 2 additions & 1 deletion examples/apps/django2/project/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""

from bokeh.server.django import autoload
from bokeh.server.django import autoload, static_extensions
from django.apps import apps
from django.contrib import admin
from django.urls import path, include
Expand All @@ -33,4 +33,5 @@
autoload("sliders", sliders_app.app),
]

urlpatterns += static_extensions()
urlpatterns += staticfiles_urlpatterns()
5 changes: 0 additions & 5 deletions examples/apps/django_multi_apps/django_multi_apps/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# local
'channels',
'bokeh.server.django',
Expand Down Expand Up @@ -129,7 +128,3 @@
STATICFILES_DIRS = [bokehjsdir()]

COLOR_MAP = 'Paired'

# Ensure that bokeh resources are loaded from CDN
# (loading from server broken as of Bokeh 2.0.1 so only CDN and INLINE will work)
settings.resources = 'cdn'
3 changes: 2 additions & 1 deletion examples/apps/django_multi_apps/django_multi_apps/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""

from bokeh.server.django import autoload
from bokeh.server.django import autoload, static_extensions
from django.apps import apps
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
Expand Down Expand Up @@ -42,6 +42,7 @@
autoload("stockscreener", stockscreener_app.app),
]

urlpatterns += static_extensions()
urlpatterns += staticfiles_urlpatterns()

# Set the themes
Expand Down
5 changes: 3 additions & 2 deletions examples/user_guide/Django_Apps.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@
"]\n",
"```\n",
"\n",
"and lastly add the app(s) we want to add to the `urls.py` file:\n",
"and lastly add the app(s) and `static_extensions()` to the `urlpatterns` in the `urls.py` file:\n",
"\n",
"```\n",
"from bokeh.server.django import autoload\n",
"from bokeh.server.django import autoload, static_extensions\n",
"from django.apps import apps\n",
"from django.contrib import admin\n",
"from django.urls import path, include\n",
Expand All @@ -104,6 +104,7 @@
" autoload(\"sliders\", sliders_app.app),\n",
"]\n",
"\n",
"urlpatterns += static_extensions()\n",
"urlpatterns += staticfiles_urlpatterns()\n",
"```\n",
"\n",
Expand Down

0 comments on commit 1df70b5

Please sign in to comment.