Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use django-environ for managing environmental settings in cookicutters #386

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ jobs:
nodeenv -p && \
npm install -g npm-check-updates && \
find ./docker -name package.json -exec ncu --packageFile {} -u \;
- name: Push to main branch
run: |
git config --global user.name "xmedr"
git config --global user.email "[email protected]"
# - name: Push to main branch
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

automated updating of requirements go us to a point where we these cookie cutters were in a broken state. let's pause until we can figure out a better way to upgrade deps.

# run: |
# git config --global user.name "xmedr"
# git config --global user.email "[email protected]"

git add .
git commit -m "Update pypi and node dependencies"
git push origin ${{ github.ref_name }}
# git add .
# git commit -m "Update pypi and node dependencies"
# git push origin ${{ github.ref_name }}
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,9 @@
"css-loader": "^7.1.2",
"eslint": "^9.12.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-react-app": "^7.0.1",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all of the deps are not compatible with eslint 9.12

"eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jsx-a11y": "^6.10.0",
"eslint-plugin-react": "^7.37.1",
"eslint-plugin-react-hooks": "^4.6.2",
"style-loader": "^4.0.0",
"webpack": "^5.95.0",
"webpack-bundle-tracker": "^3.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Django
psycopg2
gunicorn
dj-database-url
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need this with django-environ

django-environ
whitenoise
django-webpack-loader
sentry-sdk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,37 @@
"""
import os

import dj_database_url
import environ
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration

from {{cookiecutter.module_name}}.logging import before_send


env = environ.Env(DJANGO_DEBUG=(bool, True),
DJANGO_ALLOWED_HOSTS=(list, []),
SENTRY_DSN=(str, ''),
POSTGRES_REQUIRE_SSL=(bool, False),
DJANGO_ALLOW_SEARCH_INDEXING=(bool, False))

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# Retrieve the secret key from the DJANGO_SECRET_KEY environment variable
SECRET_KEY = os.environ['DJANGO_SECRET_KEY']
SECRET_KEY = env('DJANGO_SECRET_KEY')

# Set the DJANGO_DEBUG environment variable to False to disable debug mode
DEBUG = False if os.getenv('DJANGO_DEBUG', True) == 'False' else True
DEBUG = env("DJANGO_DEBUG")

# Define DJANGO_ALLOWED_HOSTS as a comma-separated list of valid hosts,
# e.g. localhost,127.0.0.1,.herokuapp.com
allowed_hosts = os.getenv('DJANGO_ALLOWED_HOSTS', [])
ALLOWED_HOSTS = allowed_hosts.split(',') if allowed_hosts else []
ALLOWED_HOSTS = env('DJANGO_ALLOWED_HOSTS')


# Configure Sentry for error logging
if os.getenv('SENTRY_DSN'):
if env('SENTRY_DSN'):
sentry_sdk.init(
dsn=os.environ['SENTRY_DSN'],
dsn=env('SENTRY_DSN'),
before_send=before_send,
integrations=[DjangoIntegration()],
)
Expand Down Expand Up @@ -90,17 +96,21 @@

DATABASES = {}

DATABASES['default'] = dj_database_url.parse(
os.getenv('DATABASE_URL', 'postgres://postgres:postgres@postgres:5432/{{cookiecutter.pg_db}}'),
conn_max_age=600,
ssl_require=True if os.getenv('POSTGRES_REQUIRE_SSL') else False{% if cookiecutter.postgis == 'True' %},
engine='django.contrib.gis.db.backends.postgis'{% endif %}
# env.db_url returns a dictionary of database connection settings derived
# from the connection string. we have some settings we want to always use
# so we uniont those settings with one coming from the db string
DATABASES["default"] = {
"CONN_MAX_AGE": 600,
"OPTIONS": {"sslmode": "require" if env("POSTGRES_REQUIRE_SSL") else "prefer"},
} | env.db_url(
"DATABASE_URL",
default='{{ "postgis" if cookiecutter.postgis else "postgres" }}://postgres:postgres@postgres:5432/{{cookiecutter.pg_db}}',
)

# Caching
# https://docs.djangoproject.com/en/3.0/topics/cache/

cache_backend = 'dummy.DummyCache' if DEBUG is True else 'db.DatabaseCache'
cache_backend = 'dummy.DummyCache' if DEBUG else 'db.DatabaseCache'
CACHES = {
'default': {
'BACKEND': f'django.core.cache.backends.{cache_backend}',
Expand Down Expand Up @@ -146,9 +156,9 @@
STATIC_URL = '/static/'
STATIC_ROOT = '/static'
STATICFILES_DIRS = (os.path.join(BASE_DIR, "assets"),)
STATICFILES_STORAGE = os.getenv(
STATICFILES_STORAGE = env(
'DJANGO_STATICFILES_STORAGE',
'whitenoise.storage.CompressedManifestStaticFilesStorage'
default='whitenoise.storage.CompressedManifestStaticFilesStorage'
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
Expand All @@ -171,7 +181,7 @@

# Disable search indexing by default. Set DJANGO_ALLOW_SEARCH_INDEXING env
# variable to True in container or deploymeny environment to enable indexing.
if os.getenv('DJANGO_ALLOW_SEARCH_INDEXING', False) == 'True':
if env('DJANGO_ALLOW_SEARCH_INDEXING'):
ALLOW_SEARCH_INDEXING = True
else:
ALLOW_SEARCH_INDEXING = False
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ ENV DJANGO_DEBUG 'False'

# Build static files into the container
RUN python manage.py collectstatic --noinput
RUN python manage.py compress
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was failing with this error. I don't know why, but it's unrelated to the django-environ stuff.

 > [app 12/12] RUN python manage.py compress:
0.668 Traceback (most recent call last):
0.668   File "/app/manage.py", line 22, in <module>
0.668     main()
0.668   File "/app/manage.py", line 18, in main
0.668 AWS config not found, defaulting to local storage
0.668 Compressing... Invalid template project/base.html: Invalid block tag on line 50: 'raw'. Did you forget to register or load this tag?
0.668 Error parsing template project/static_page.html: Invalid block tag on line 50: 'raw'. Did you forget to register or load this tag?
0.668 Error parsing template project/500.html: Invalid block tag on line 50: 'raw'. Did you forget to register or load this tag?
0.668 Error parsing template project/404.html: Invalid block tag on line 50: 'raw'. Did you forget to register or load this tag?
0.668 Error parsing template project/home_page.html: Invalid block tag on line 50: 'raw'. Did you forget to register or load this tag?
0.668 Error parsing template project/react_page.html: Invalid block tag on line 50: 'raw'. Did you forget to register or load this tag?
0.668     execute_from_command_line(sys.argv)
0.668   File "/usr/local/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
0.668     utility.execute()
0.668   File "/usr/local/lib/python3.11/site-packages/django/core/management/__init__.py", line 436, in execute
0.668     self.fetch_command(subcommand).run_from_argv(self.argv)
0.668   File "/usr/local/lib/python3.11/site-packages/django/core/management/base.py", line 413, in run_from_argv
0.669     self.execute(*args, **cmd_options)
0.669   File "/usr/local/lib/python3.11/site-packages/django/core/management/base.py", line 459, in execute
0.669     output = self.handle(*args, **options)
0.669              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0.669   File "/usr/local/lib/python3.11/site-packages/compressor/management/commands/compress.py", line 370, in handle
0.669     self.handle_inner(**options)
0.669   File "/usr/local/lib/python3.11/site-packages/compressor/management/commands/compress.py", line 395, in handle_inner
0.669     offline_manifest, block_count, results = self.compress(
0.669                                              ^^^^^^^^^^^^^^
0.670   File "/usr/local/lib/python3.11/site-packages/compressor/management/commands/compress.py", line 296, in compress
0.670     raise OfflineGenerationError(
0.670 compressor.exceptions.OfflineGenerationError: No 'compress' template tags found in templates.Try running compress command with --follow-links and/or--extension=EXTENSIONS
------

#RUN python manage.py compress
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@
"@babel/eslint-parser": "^7.25.7",
"eslint": "^9.12.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-react-app": "^7.0.1",
"eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jsx-a11y": "^6.10.0",
"eslint-plugin-react": "^7.37.1",
"eslint-plugin-react-hooks": "^4.6.2"
"eslint-plugin-react": "^7.37.1"
},
"scripts": {
"develop": "sass --watch /app/{{ cookiecutter.module_name }}/static/scss/custom.scss:/app/{{ cookiecutter.module_name }}/static/css/bootstrap.custom.css"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
Django==5.1.1
psycopg2==2.9.9
gunicorn==23.0.0
dj-database-url==2.2.0
whitenoise==6.7.0
django-environ==0.11.2
django-compressor==4.5.1
django-storages==1.14.4
boto3==1.35.34
sentry-sdk==2.15.0
wagtail==6.2.2
csvkit==2.0.1
wagtail-modeladmin==2.0.0
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated dep fixing.


pytest==8.3.3
pytest-django==4.9.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from wagtail.core import blocks
from wagtail import blocks
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all the wagtail stuff is unrelated dependency fixing.

from wagtail.contrib.table_block.blocks import TableBlock as WagtailTableBlock
from wagtail.images.blocks import ImageChooserBlock

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import os
import json

from django.core.files.storage import default_storage
from django.files.storage import default_storage
from django.apps import apps
from django.core.management.base import BaseCommand
from django.core.management import call_command
from django.core.exceptions import ObjectDoesNotExist
from django.management.base import BaseCommand
from django.management import call_command
from django.exceptions import ObjectDoesNotExist

from wagtail.core.models import Site, Page, PageRevision
from wagtail.models import Site, Page, PageRevision
from wagtail.images.models import Image


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from django.db import migrations, models
import django.db.models.deletion
import {{ cookiecutter.module_name }}.blocks
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.blocks
import wagtail.fields
import wagtail.embeds.blocks
import wagtail.images.blocks

Expand All @@ -22,8 +22,8 @@ class Migration(migrations.Migration):
name='HomePage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')),
('body', wagtail.core.fields.StreamField([('paragraph', wagtail.core.blocks.RichTextBlock()), ('heading', wagtail.core.blocks.CharBlock(form_classname='full title', icon='title')), ('accordion', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock()), ('paragraph', wagtail.core.blocks.RichTextBlock())]), icon='list-ul')), ('button', wagtail.core.blocks.StructBlock([('text', wagtail.core.blocks.CharBlock()), ('link', wagtail.core.blocks.URLBlock())])), ('callout', wagtail.core.blocks.StructBlock([('paragraph', wagtail.core.blocks.RichTextBlock())])), ('table', {{ cookiecutter.module_name }}.blocks.TableBlock()), ('embedded_media', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock(required=False)), ('media_link', wagtail.embeds.blocks.EmbedBlock()), ('description', wagtail.core.blocks.TextBlock(required=False))], icon='media')), ('team_members', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('first_name', wagtail.core.blocks.CharBlock()), ('last_name', wagtail.core.blocks.CharBlock()), ('position', wagtail.core.blocks.CharBlock()), ('photo', wagtail.images.blocks.ImageChooserBlock(required=False))]), icon='group'))])),
('intro_text', wagtail.core.fields.RichTextField(blank=True)),
('body', wagtail.fields.StreamField([('paragraph', wagtail.blocks.RichTextBlock()), ('heading', wagtail.blocks.CharBlock(form_classname='full title', icon='title')), ('accordion', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('paragraph', wagtail.blocks.RichTextBlock())]), icon='list-ul')), ('button', wagtail.blocks.StructBlock([('text', wagtail.blocks.CharBlock()), ('link', wagtail.blocks.URLBlock())])), ('callout', wagtail.blocks.StructBlock([('paragraph', wagtail.blocks.RichTextBlock())])), ('table', {{ cookiecutter.module_name }}.blocks.TableBlock()), ('embedded_media', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(required=False)), ('media_link', wagtail.embeds.blocks.EmbedBlock()), ('description', wagtail.blocks.TextBlock(required=False))], icon='media')), ('team_members', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('first_name', wagtail.blocks.CharBlock()), ('last_name', wagtail.blocks.CharBlock()), ('position', wagtail.blocks.CharBlock()), ('photo', wagtail.images.blocks.ImageChooserBlock(required=False))]), icon='group'))])),
('intro_text', wagtail.fields.RichTextField(blank=True)),
],
options={
'abstract': False,
Expand All @@ -34,7 +34,7 @@ class Migration(migrations.Migration):
name='StaticPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')),
('body', wagtail.core.fields.StreamField([('paragraph', wagtail.core.blocks.RichTextBlock()), ('heading', wagtail.core.blocks.CharBlock(form_classname='full title', icon='title')), ('accordion', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock()), ('paragraph', wagtail.core.blocks.RichTextBlock())]), icon='list-ul')), ('button', wagtail.core.blocks.StructBlock([('text', wagtail.core.blocks.CharBlock()), ('link', wagtail.core.blocks.URLBlock())])), ('callout', wagtail.core.blocks.StructBlock([('paragraph', wagtail.core.blocks.RichTextBlock())])), ('table', {{ cookiecutter.module_name }}.blocks.TableBlock()), ('embedded_media', wagtail.core.blocks.StructBlock([('title', wagtail.core.blocks.CharBlock(required=False)), ('media_link', wagtail.embeds.blocks.EmbedBlock()), ('description', wagtail.core.blocks.TextBlock(required=False))], icon='media')), ('team_members', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('first_name', wagtail.core.blocks.CharBlock()), ('last_name', wagtail.core.blocks.CharBlock()), ('position', wagtail.core.blocks.CharBlock()), ('photo', wagtail.images.blocks.ImageChooserBlock(required=False))]), icon='group'))])),
('body', wagtail.fields.StreamField([('paragraph', wagtail.blocks.RichTextBlock()), ('heading', wagtail.blocks.CharBlock(form_classname='full title', icon='title')), ('accordion', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('paragraph', wagtail.blocks.RichTextBlock())]), icon='list-ul')), ('button', wagtail.blocks.StructBlock([('text', wagtail.blocks.CharBlock()), ('link', wagtail.blocks.URLBlock())])), ('callout', wagtail.blocks.StructBlock([('paragraph', wagtail.blocks.RichTextBlock())])), ('table', {{ cookiecutter.module_name }}.blocks.TableBlock()), ('embedded_media', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(required=False)), ('media_link', wagtail.embeds.blocks.EmbedBlock()), ('description', wagtail.blocks.TextBlock(required=False))], icon='media')), ('team_members', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('first_name', wagtail.blocks.CharBlock()), ('last_name', wagtail.blocks.CharBlock()), ('position', wagtail.blocks.CharBlock()), ('photo', wagtail.images.blocks.ImageChooserBlock(required=False))]), icon='group'))])),
],
options={
'abstract': False,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from wagtail.core.models import Page
from wagtail.core.fields import RichTextField, StreamField
from wagtail.core import blocks
from wagtail.models import Page
from wagtail.fields import RichTextField, StreamField
from wagtail import blocks
from wagtail.embeds.blocks import EmbedBlock
from wagtail.admin.edit_handlers import StreamFieldPanel, FieldPanel
from wagtail.admin.panels import FieldPanel

from {{cookiecutter.module_name}}.blocks import (
AccordionBlock,
Expand Down Expand Up @@ -53,7 +53,7 @@ class Meta:

class StaticPage(BasePage):
content_panels = Page.content_panels + [
StreamFieldPanel('body'),
FieldPanel('body'),
]

parent_page_types = ['{{ cookiecutter.module_name }}.HomePage']
Expand All @@ -64,7 +64,7 @@ class HomePage(BasePage):

content_panels = Page.content_panels + [
FieldPanel('intro_text'),
StreamFieldPanel('body')
FieldPanel('body')
]

max_count = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,38 @@
"""
import os

import dj_database_url
import environ
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
from django.templatetags.static import static

from {{cookiecutter.module_name}}.logging import before_send


env = environ.Env(DJANGO_DEBUG=(bool, True),
DJANGO_ALLOWED_HOSTS=(list, []),
SENTRY_DSN=(str, ''),
POSTGRES_REQUIRE_SSL=(bool, False),
DJANGO_ALLOW_SEARCH_INDEXING=(bool, False))

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# Retrieve the secret key from the DJANGO_SECRET_KEY environment variable
SECRET_KEY = os.environ['DJANGO_SECRET_KEY']
SECRET_KEY = env('DJANGO_SECRET_KEY')

# Set the DJANGO_DEBUG environment variable to False to disable debug mode
DEBUG = False if os.getenv('DJANGO_DEBUG', True) == 'False' else True
DEBUG = env('DJANGO_DEBUG')

# Define DJANGO_ALLOWED_HOSTS as a comma-separated list of valid hosts,
# e.g. localhost,127.0.0.1,.herokuapp.com
allowed_hosts = os.getenv('DJANGO_ALLOWED_HOSTS', [])
ALLOWED_HOSTS = allowed_hosts.split(',') if allowed_hosts else []
ALLOWED_HOSTS = env('DJANGO_ALLOWED_HOSTS')


# Configure Sentry for error logging
if os.getenv('SENTRY_DSN'):
if env('SENTRY_DSN'):
sentry_sdk.init(
dsn=os.environ['SENTRY_DSN'],
dsn=env('SENTRY_DSN'),
before_send=before_send,
integrations=[DjangoIntegration()],
)
Expand All @@ -51,7 +57,7 @@
'django.contrib.messages',
'django.contrib.staticfiles',
'wagtail.contrib.forms',
'wagtail.contrib.modeladmin',
'wagtail_modeladmin',
'wagtail.contrib.redirects',
'wagtail.contrib.simple_translation',
'wagtail.contrib.table_block',
Expand All @@ -64,7 +70,7 @@
'wagtail.images',
'wagtail.search',
'wagtail.admin',
'wagtail.core',
'wagtail',
'modelcluster',
'taggit',
'compressor',
Expand Down Expand Up @@ -117,12 +123,15 @@

DATABASES = {}

DATABASES['default'] = dj_database_url.parse(
os.getenv('DATABASE_URL',
'postgis://postgres:postgres@postgres:5432/{{ cookiecutter.module_name }}'),
conn_max_age=600,
ssl_require=True if os.getenv('POSTGRES_REQUIRE_SSL') else False,
engine='django.contrib.gis.db.backends.postgis'
# env.db_url returns a dictionary of database connection settings derived
# from the connection string. we have some settings we want to always use
# so we uniont those settings with one coming from the db string
DATABASES["default"] = {
"CONN_MAX_AGE": 600,
"OPTIONS": {"sslmode": "require" if env("POSTGRES_REQUIRE_SSL") else "prefer"},
} | env.db_url(
"DATABASE_URL",
default='postgis://postgres:postgres@postgres:5432/{{cookiecutter.module_name}}',
)

# Caching
Expand Down Expand Up @@ -173,9 +182,9 @@

STATIC_URL = '/static/'
STATIC_ROOT = '/static'
STATICFILES_STORAGE = os.getenv(
STATICFILES_STORAGE = env(
'DJANGO_STATICFILES_STORAGE',
'whitenoise.storage.CompressedManifestStaticFilesStorage'
default='whitenoise.storage.CompressedManifestStaticFilesStorage'
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django import template
from wagtail.core.models import Page
from wagtail.models import Page

register = template.Library()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django import template
from wagtail.core.models import Page
from wagtail.models import Page

register = template.Library()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from .views import ReactView

from wagtail.admin import urls as wagtailadmin_urls
from wagtail.core import urls as wagtail_urls
from wagtail import urls as wagtail_urls
from wagtail.documents import urls as wagtaildocs_urls


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from wagtail.core.models import Page
from wagtail.models import Page


def get_site_menu():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from django.utils.html import escape
from wagtail.admin.rich_text.converters.html_to_contentstate import BlockElementHandler
import wagtail.admin.rich_text.editors.draftail.features as draftail_features
from wagtail.core import hooks
from wagtail.core.rich_text import LinkHandler
from wagtail import hooks
from wagtail.rich_text import LinkHandler


@hooks.register('register_rich_text_features')
Expand Down