Settings

The following settings are available for configuration through your project. All settings are customized by prefixing WIKI_, so for instance URL_CASE_SENSITIVE should be configured as WIKI_URL_CASE_SENSITIVE. For plugins the prefix is WIKI_PLUGINNAME_, e.g. WIKI_IMAGES for the images plugin.

wiki.conf.settings.ACCOUNT_HANDLING = True

Sign up, login and logout views should be accessible.

wiki.conf.settings.ACCOUNT_SIGNUP_ALLOWED = True

Signup allowed? If it’s not allowed, logged in superusers can still access the signup page to create new users.

wiki.conf.settings.ANONYMOUS = True

Treat anonymous (i.e. non logged in) users as the “other” user group.

wiki.conf.settings.ANONYMOUS_CREATE = False

Globally enable create access for anonymous users. Defaults to ANONYMOUS_WRITE.

wiki.conf.settings.ANONYMOUS_UPLOAD = False

Default setting to allow anonymous users upload access. Used in plugins.attachments and plugins.images, and can be overwritten in these plugins.

wiki.conf.settings.ANONYMOUS_WRITE = True

Globally enable write access for anonymous users, if true anonymous users will be treated as the others_write boolean field on models.Article.

wiki.conf.settings.CACHE_TIMEOUT = 600

Seconds of timeout before renewing the article cache. Articles are automatically renewed whenever an edit occurs but article content may be generated from other objects that are changed.

wiki.conf.settings.CAN_ADMIN = None

A function returning True/False if a user has permission to create new groups and users for the wiki.

wiki.conf.settings.CAN_ASSIGN = None

A function returning True/False if a user has permission to assign permissions on an article. Relevance: Changing owner and group membership.

wiki.conf.settings.CAN_ASSIGN_OWNER = None

A function returning True/False if the owner of an article has permission to change the group to a user’s own groups. Relevance: Changing group membership.

wiki.conf.settings.CAN_CHANGE_PERMISSIONS = None

A function returning True/False if a user has permission to change read/write access for groups and others.

wiki.conf.settings.CAN_DELETE = None

Specifies if a user has access to soft deletion of articles.

wiki.conf.settings.CAN_MODERATE = None

A function returning True/False if a user has permission to change moderate, ie. lock articles and permanently delete content.

wiki.conf.settings.CAN_READ = None

A function returning True/False if a user has permission to read contents of an article and plugins. Relevance: Viewing articles and plugins.

wiki.conf.settings.CAN_WRITE = None

A function returning True/False if a user has permission to change contents, i.e. add new revisions to an article. Often, plugins also use this. Relevance: Editing articles, changing revisions, editing plugins.

wiki.conf.settings.CHECK_SLUG_URL_AVAILABLE = True

When True, this blocks new slugs that resolve to non-wiki views, stopping users creating articles that conflict with overlapping URLs from other apps.

wiki.conf.settings.EDITOR = 'wiki.editors.markitup.MarkItUp'

The editor class to use – maybe a 3rd party or your own…? You can always extend the built-in editor and customize it!

wiki.conf.settings.GROUP_MODEL = 'auth.Group'

Choose the Group model to use for permission handling. Defaults to django’s auth.Group.

wiki.conf.settings.LOG_IPS_ANONYMOUS = True

Do we want to log IPs of anonymous users?

wiki.conf.settings.LOG_IPS_USERS = False

Do we want to log IPs of logged in users?

wiki.conf.settings.LOST_AND_FOUND_SLUG = 'lost-and-found'

This slug is used in URLPath if an article has been deleted. The children of the URLPath of that article are moved to lost and found. They keep their permissions and all their content.

wiki.conf.settings.MARKDOWN_HTML_ATTRIBUTES = {'a': ['href', 'title', 'class', 'id', 'target', 'rel'], 'abbr': ['title', 'class', 'id', 'target', 'rel'], 'acronym': ['title', 'class', 'id', 'target', 'rel'], 'b': ['class', 'id', 'target', 'rel'], 'blockquote': ['class', 'id', 'target', 'rel'], 'br': ['class', 'id', 'target', 'rel'], 'code': ['class', 'id', 'target', 'rel'], 'dd': ['class', 'id', 'target', 'rel'], 'details': ['class'], 'div': ['class', 'id', 'target', 'rel'], 'dl': ['class', 'id', 'target', 'rel'], 'dt': ['class', 'id', 'target', 'rel'], 'em': ['class', 'id', 'target', 'rel'], 'figcaption': ['class', 'id', 'target', 'rel'], 'figure': ['class', 'id', 'target', 'rel'], 'h1': ['class', 'id', 'target', 'rel'], 'h2': ['class', 'id', 'target', 'rel'], 'h3': ['class', 'id', 'target', 'rel'], 'h4': ['class', 'id', 'target', 'rel'], 'h5': ['class', 'id', 'target', 'rel'], 'h6': ['class', 'id', 'target', 'rel'], 'hr': ['class', 'id', 'target', 'rel'], 'i': ['class', 'id', 'target', 'rel'], 'img': ['class', 'id', 'target', 'rel', 'src', 'alt'], 'li': ['class', 'id', 'target', 'rel'], 'ol': ['class', 'id', 'target', 'rel'], 'p': ['class', 'id', 'target', 'rel'], 'pre': ['class', 'id', 'target', 'rel'], 'span': ['class', 'id', 'target', 'rel'], 'strong': ['class', 'id', 'target', 'rel'], 'sup': ['class', 'id', 'target', 'rel'], 'table': ['class', 'id', 'target', 'rel'], 'tbody': ['class', 'id', 'target', 'rel'], 'td': ['class', 'id', 'target', 'rel', 'align'], 'th': ['class', 'id', 'target', 'rel'], 'thead': ['class', 'id', 'target', 'rel'], 'tr': ['class', 'id', 'target', 'rel'], 'ul': ['class', 'id', 'target', 'rel']}

Dictionary of allowed attributes in Markdown article contents.

wiki.conf.settings.MARKDOWN_HTML_STYLES = []

Allowed inline styles in Markdown article contents, default is no styles (empty list).

wiki.conf.settings.MARKDOWN_HTML_WHITELIST = frozenset({'a', 'abbr', 'acronym', 'b', 'blockquote', 'br', 'code', 'dd', 'details', 'div', 'dl', 'dt', 'em', 'figcaption', 'figure', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'img', 'li', 'ol', 'p', 'pre', 'span', 'strong', 'summary', 'sup', 'table', 'tbody', 'td', 'th', 'thead', 'tr', 'ul'})

List of allowed tags in Markdown article contents.

wiki.conf.settings.MARKDOWN_KWARGS = {'extension_configs': {'wiki.plugins.macros.mdx.toc': {'title': 'Contents'}}, 'extensions': ['markdown.extensions.footnotes', 'markdown.extensions.attr_list', 'markdown.extensions.footnotes', 'markdown.extensions.attr_list', 'markdown.extensions.def_list', 'markdown.extensions.tables', 'markdown.extensions.abbr', 'markdown.extensions.sane_lists']}

Arguments for the Markdown instance, as a dictionary. The “extensions” key should be a list of extra extensions to use besides the built-in django-wiki extensions, and the “extension_configs” should be a dictionary, specifying the keyword-arguments to pass to each extension.

For a list of extensions officially supported by Python-Markdown, see: https://python-markdown.github.io/extensions/

To set a custom title for table of contents, specify the following in your Django project settings:

WIKI_MARKDOWN_KWARGS = {
    'extension_configs': {
        'wiki.plugins.macros.mdx.toc': {'title': 'Contents of this article'},
    },
}

Besides the extensions enabled by the “extensions” key, the following built-in django-wiki extensions can be configured with “extension_configs”: “wiki.core.markdown.mdx.codehilite”, “wiki.core.markdown.mdx.previewlinks”, “wiki.core.markdown.mdx.responsivetable”, “wiki.plugins.macros.mdx.macro”, “wiki.plugins.macros.mdx.toc”, “wiki.plugins.macros.mdx.wikilinks”.

wiki.conf.settings.MARKDOWN_SANITIZE_HTML = True

Whether to use Bleach or not. It’s not recommended to turn this off unless you know what you’re doing and you don’t want to use the other options.

wiki.conf.settings.MESSAGE_TAG_CSS_CLASS = {10: 'alert alert-info', 20: 'alert alert-info', 25: 'alert alert-success', 30: 'alert alert-warning', 40: 'alert alert-danger'}

Mapping from message.level to bootstrap class names.

wiki.conf.settings.REVISIONS_MINUTES_LOOKBACK = 2

Number of minutes to look back for looking up REVISIONS_PER_MINUTES and REVISIONS_PER_MINUTES_ANONYMOUS.

wiki.conf.settings.REVISIONS_PER_HOUR = 60

Maximum allowed revisions per hour for any given user or IP.

wiki.conf.settings.REVISIONS_PER_HOUR_ANONYMOUS = 10

Maximum allowed revisions per hour for any anonymous user and any IP.

wiki.conf.settings.REVISIONS_PER_MINUTES = 5

Maximum allowed revisions per minute for any given user or IP.

wiki.conf.settings.REVISIONS_PER_MINUTES_ANONYMOUS = 2

Maximum allowed revisions per minute for any anonymous user and any IP.

wiki.conf.settings.SHOW_MAX_CHILDREN = 20

Maximum amount of children to display in a menu before showing “+more”. NEVER set this to 0 as it will wrongly inform the user that there are no children and for instance that an article can be safely deleted.

wiki.conf.settings.STORAGE_BACKEND = <django.core.files.storage.DefaultStorage object>

Default Django storage backend to use for images, attachments etc.

wiki.conf.settings.URL_CASE_SENSITIVE = False

Should urls be case sensitive?

wiki.conf.settings.URL_CONFIG_CLASS = None

Dotted name of the class used to construct urlpatterns for the wiki. Default is wiki.urls.WikiURLPatterns. To customize urls or view handlers, you can derive from this.

wiki.conf.settings.USE_BOOTSTRAP_SELECT_WIDGET = True

User Bootstrap’s select widget. Switch off if you’re not using Bootstrap!

wiki.conf.settings.USE_SENDFILE = False

Use django-sendfile for sending out files? Otherwise the whole file is first read into memory and than send with a mime type based on the file.

Weather to append a trailing slash to rendered Wikilinks. Defaults to True

Plugin attachments

wiki.plugins.attachments.settings.ANONYMOUS = False

Allow anonymous users upload access (not nice on an open network) WIKI_ATTACHMENTS_ANONYMOUS can override this, otherwise the default in wiki.conf.settings is used.

wiki.plugins.attachments.settings.APPEND_EXTENSION = True

Store files always with an appended .upload extension to be sure that something nasty does not get executed on the server. SAFETY FIRST!

wiki.plugins.attachments.settings.FILE_EXTENSIONS = ['pdf', 'doc', 'odt', 'docx', 'txt']

Allowed extensions for attachments, empty to disallow uploads completely. If WIKI_ATTACHMENTS_APPEND_EXTENSION files are saved with an appended “.upload” to the file to ensure that your web server never actually executes some script. The extensions are case insensitive. You are asked to explicitly enter all file extensions that you want to allow. For your own safety. Note: this setting is called WIKI_ATTACHMENTS_EXTENSIONS not WIKI_ATTACHMENTS_FILE_EXTENTIONS

wiki.plugins.attachments.settings.STORAGE_BACKEND = <django.core.files.storage.DefaultStorage object>

Storage backend to use, default is to use the same as the rest of the wiki, which is set in WIKI_STORAGE_BACKEND, but you can override it with WIKI_ATTACHMENTS_STORAGE_BACKEND.

wiki.plugins.attachments.settings.UPLOAD_PATH = 'wiki/attachments/%aid/'

Where to store article attachments, relative to MEDIA_ROOT. You should NEVER enable directory indexing in MEDIA_ROOT/UPLOAD_PATH! Actually, you can completely disable serving it, if you want. Files are sent to the user through a Django view that reads and streams a file.

wiki.plugins.attachments.settings.UPLOAD_PATH_OBSCURIFY = True

Should the upload path be obscurified? If so, a random hash will be added to the path such that someone can not guess the location of files (if you have restricted permissions and the files are still located within the web server’s file system).

wiki.plugins.attachments.settings.USE_LOCAL_PATH = True

Important for e.g. S3 backends: If your storage backend does not have a .path attribute for the file, but only a .url attribute, you should use False. This will reveal the direct download URL so it does not work perfectly for files you wish to be kept private.

Plugin editsection

Text used for the section edit links which will appear next to section headers. These links allow editing only the text of one particular section.

wiki.plugins.editsection.settings.MAX_LEVEL = 3

Add “[edit]” links to all section headers till this level. By using these links editing only the text from the selected section is possible.

Plugin images

wiki.plugins.images.settings.ANONYMOUS = False

Allow anonymous users upload access (not nice on an open network). WIKI_IMAGES_ANONYMOUS can override this, otherwise the default in wiki.conf.settings is used.

wiki.plugins.images.settings.IMAGE_PATH = 'wiki/images/%aid/'

Location where uploaded images are stored. %aid is replaced by the article id.

wiki.plugins.images.settings.IMAGE_PATH_OBSCURIFY = True

Should the upload path be obscurified? If so, a random hash will be added to the path such that someone can not guess the location of files (if you have restricted permissions and the files are still located within the web server’s file system).

wiki.plugins.images.settings.STORAGE_BACKEND = <django.core.files.storage.DefaultStorage object>

Storage backend to use, default is to use the same as the rest of the wiki, which is set in WIKI_STORAGE_BACKEND, but you can override it with WIKI_IMAGES_STORAGE_BACKEND.

wiki.plugins.images.settings.THUMBNAIL_SIZES = {'default': '250x250', 'large': '500x500', 'medium': '300x300', 'orig': None, 'small': '150x150'}

Size for the image thumbnail included in the HTML text. If no specific size is given in the markdown tag the default size is used. If a specific size is given in the markdown tag that size is used.

Plugin links

wiki.plugins.links.settings.LOOKUP_LEVEL = 2

If a relative slug is used in a wiki markdown link and no article is found with the given slug starting at the current articles level a link to a not yet existing article is created. Creating the article can be done by following the link. This link will be relative to LOOKUP_LEVEL. This should be the level that most articles are created at.

Plugin macros

wiki.plugins.macros.settings.METHODS = ('article_list', 'toc')

List of markdown extensions this plugin should support. article_list inserts a list of articles from the current level. toc inserts a table of contents matching the headings.