Settings

Note

If you're unsure about what "Django settings" are, you can refer to How to Edit Django Settings in OpenWISP for guidance.

OPENWISP_ADMIN_SITE_CLASS

Default: openwisp_utils.admin_theme.admin.OpenwispAdminSite

If you need to use a customized admin site class, you can use this setting.

OPENWISP_ADMIN_SITE_TITLE

Default: OpenWISP Admin

Title value used in the <title> HTML tag of the admin site.

OPENWISP_ADMIN_SITE_HEADER

Default: OpenWISP

Heading text used in the main <h1> HTML tag (the logo) of the admin site.

OPENWISP_ADMIN_INDEX_TITLE

Default: Network administration

Title shown to users in the index page of the admin site.

OPENWISP_ADMIN_DASHBOARD_ENABLED

Default: True

When True, enables the OpenWISP Dashboard. Upon login, the user will be greeted with the dashboard instead of the default Django admin index page.

OPENWISP_ADMIN_THEME_JS

Default: []

Allows to pass a list of strings representing URLs of custom JS files to load.

Example usage:

OPENWISP_ADMIN_THEME_JS = [
    "/static/custom-admin-theme.js",
]

OPENWISP_API_DOCS

Default: True

Whether the OpenAPI documentation is enabled.

When enabled, you can view the available documentation using the Swagger endpoint at /api/v1/docs/.

You also need to add the following URL to your project urls.py:

urlpatterns += [
    url(r"^api/v1/", include("openwisp_utils.api.urls")),
]

OPENWISP_API_INFO

Default:

{
    "title": "OpenWISP API",
    "default_version": "v1",
    "description": "OpenWISP REST API",
}

Define OpenAPI general information. NOTE: This setting requires OPENWISP_API_DOCS = True to take effect.

For more information about optional parameters check the drf-yasg documentation.

OPENWISP_SLOW_TEST_THRESHOLD

Default: [0.3, 1] (seconds)

It can be used to change the thresholds used by TimeLoggingTestRunner to detect slow tests (0.3s by default) and highlight the slowest ones (1s by default) among them.

OPENWISP_STATICFILES_VERSIONED_EXCLUDE

Default: ['leaflet/*/*.png']

Allows to pass a list of Unix shell-style wildcards for files to be excluded by CompressStaticFilesStorage.

By default Leaflet PNGs have been excluded to avoid bugs like openwisp/ansible-openwisp2#232.

Example usage:

OPENWISP_STATICFILES_VERSIONED_EXCLUDE = [
    "*png",
]

OPENWISP_HTML_EMAIL

type

bool

default

True

If True, an HTML themed version of the email can be sent using the send_email function.

OPENWISP_EMAIL_TEMPLATE

type

str

default

openwisp_utils/email_template.html

This setting allows to change the django template used for sending emails with the send_email function. It is recommended to extend the default email template as in the example below.

{% extends 'openwisp_utils/email_template.html' %}
{% block styles %}
{{ block.super }}
<style>
  .background {
    height: 100%;
    background: linear-gradient(to bottom, #8ccbbe 50%, #3797a4 50%);
    background-repeat: no-repeat;
    background-attachment: fixed;
    padding: 50px;
  }

  .mail-header {
    background-color: #3797a4;
    color: white;
  }
</style>
{% endblock styles %}

Similarly, you can customize the HTML of the template by overriding the body block. See email_template.html for reference implementation.

OPENWISP_CELERY_SOFT_TIME_LIMIT

type

int

default

30 (in seconds)

Sets the soft time limit for celery tasks using OpenwispCeleryTask.

OPENWISP_CELERY_HARD_TIME_LIMIT

type

int

default

120 (in seconds)

Sets the hard time limit for celery tasks using OpenwispCeleryTask.

OPENWISP_AUTOCOMPLETE_FILTER_VIEW

type

str

default

'openwisp_utils.admin_theme.views.AutocompleteJsonView'

Dotted path to the AutocompleteJsonView used by the openwisp_utils.admin_theme.filters.AutocompleteFilter.