-
Notifications
You must be signed in to change notification settings - Fork 143
/
example.py
executable file
·66 lines (49 loc) · 1.22 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
#!/usr/bin/env python
# coding: utf-8
import os
from django.core.management import call_command
from django.conf.urls import patterns, include
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
admin.autodiscover()
urlpatterns = patterns(
'',
('^$', home),
('^admin/', include(admin.site.urls)),
)
if __name__ == '__main__':
call_command('runserver')