File: settings.py

package info (click to toggle)
django-markupfield 2.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 236 kB
  • sloc: python: 724; makefile: 16; sh: 5
file content (40 lines) | stat: -rw-r--r-- 923 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import os
import markdown
from django.utils.html import escape, linebreaks, urlize
from docutils.core import publish_parts

DEFAULT_AUTO_FIELD = "django.db.models.AutoField"

if os.environ.get("DB") == "postgres":
    DATABASES = {
        "default": {
            "ENGINE": "django.db.backends.postgresql_psycopg2",
            "NAME": "test",
            "USER": "postgres",
            "PASSWORD": "",
        }
    }
else:
    DATABASES = {
        "default": {"ENGINE": "django.db.backends.sqlite3", "NAME": "markuptest.db"}
    }


def render_rest(markup):
    parts = publish_parts(source=markup, writer_name="html4css1")
    return parts["fragment"]


MARKUP_FIELD_TYPES = [
    ("markdown", markdown.markdown),
    ("ReST", render_rest),
    ("plain", lambda markup: urlize(linebreaks(escape(markup)))),
]

INSTALLED_APPS = ("markupfield.tests",)

SECRET_KEY = "sekrit"

MIDDLEWARE_CLASSES = ()

ROOT_URLCONF = ()