Skip to content
Merged
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
9 changes: 9 additions & 0 deletions docs/references/plugins.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Hypha implements DJP: Django Plugins. A plugin system for Django.

See https://djp.readthedocs.io/ for more information.

## Some tips

You can set the `DJP_PLUGINS_DIR` environment variable to point to a directory which contains *.py files implementing plugins. Good for development and when you do not want to publish the plugin on PyPI.

Since DJP allow a plugin to override any setting you can tell Hypha to look for templates in a directory inside your plugin. This allows the plugin to override any template in Hypha.
4 changes: 4 additions & 0 deletions hypha/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os

import dj_database_url
import djp
from environs import Env

from .django import * # noqa
Expand Down Expand Up @@ -623,3 +624,6 @@
debug=SENTRY_DEBUG,
integrations=[DjangoIntegration()],
)

# Load settings from any djp plugins.
djp.settings(globals())
3 changes: 3 additions & 0 deletions hypha/urls.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import djp
from django.conf import settings
from django.contrib import admin
from django.urls import include, path, re_path
Expand Down Expand Up @@ -104,6 +105,8 @@
path("", include(wagtail_urls)),
]

# Load urls from any djp plugins.
urlpatterns += djp.urlpatterns()

if settings.DEBUG:
import debug_toolbar
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ django-web-components==0.2.0
django==4.2.16
djangorestframework-api-key==3.0.0
djangorestframework==3.15.2
djp==0.3.1
drf-nested-routers==0.93.5
environs==11.0.0
gunicorn==22.0.0
Expand Down