forked from klen/django_markdown
-
Notifications
You must be signed in to change notification settings - Fork 1
/
example.py
executable file
·71 lines (49 loc) · 1.21 KB
/
example.py
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import os
from django.core.management import call_command
from django.urls import (
include, path, re_path
)
from django.conf import settings
from django.http import HttpResponse
MODULE, _ = os.path.splitext(os.path.basename(__file__))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", MODULE)
# Settings
# --------
DEBUG = True,
ROOT_URLCONF = MODULE
SECRET_KEY = 'secret'
INSTALLED_APPS = (
'django.contrib.contenttypes',
'django.contrib.messages',
'django.contrib.auth',
'django.contrib.admin',
)
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.messages.context_processors.messages',
'django.contrib.auth.context_processors.auth',
)
if not settings.configured:
settings.configure(**locals())
# Models
# ------
from django.db import models
from django_markdown.models import MarkdownField
class Test(models.Model):
content = MarkdownField()
class Meta:
app_label = 'test'
# Views
# -----
def home(request):
return HttpResponse('OK')
# Urls
# ----
from django.contrib import admin
from .views import home
admin.autodiscover()
urlpatterns = [
('^$', home),
('^admin/', include(admin.site.urls)),
]
if __name__ == '__main__':
call_command('runserver')