]> git.sommitrealweird.co.uk Git - sommitrealweird.git/blob - sommitrealweird/settings.py
Update to work with newer django and python3
[sommitrealweird.git] / sommitrealweird / settings.py
1 # Django settings for sommitrealweird project.
2
3 # Rather than editing these here, add them to the localsettings.py file which
4 # will be included at the end of the run
5
6 import os
7 from pathlib import Path
8
9 BASE_DIR = Path(__file__).resolve().parent.parent
10
11 topdir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
12
13 ADMINS = (
14     ('Brett Parker', 'iDunno@sommitrealweird.co.uk'),
15 )
16
17 ALLOWED_HOSTS = [
18     "www.sommitrealweird.co.uk",
19     "www.sommitrealweird.co.uk.",
20     "10.0.3.191",
21     "127.0.0.1",
22     "localhost",
23 ]
24
25 MANAGERS = ADMINS
26
27 DATABASES = {
28     'default': {
29             'ENGINE': 'django.db.backends.sqlite3',
30             'NAME': os.path.join(topdir, 'sommitrealweird.db')
31     }
32 }
33
34 DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
35
36 DEBUG = True
37
38
39 TIME_ZONE = 'Europe/London'
40
41 LANGUAGE_CODE = 'en-gb'
42
43 SITE_ID = 1
44
45 TEST_RUNNER = 'django.test.runner.DiscoverRunner'
46
47 # If you set this to False, Django will make some optimizations so as not
48 # to load the internationalization machinery.
49 USE_I18N = True
50
51 MEDIA_ROOT = os.path.join(topdir, 'media') + os.sep
52 MEDIA_URL = '/media/'
53
54 STATIC_ROOT = '/home/brettp/python-envs/django/lib/python3.11/site-packages/django/contrib/admin/static/'
55 STATIC_URL = '/static/'
56
57 import random
58 import string
59 key_chars = "%s%s%s" % (string.ascii_letters, string.digits, '+-()_#~')
60 SECRET_KEY = [random.choice(key_chars) for a in range(0,50)]
61
62 CACHES = {
63     'default': {
64         'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
65         'LOCATION': '%s/tmp' %(topdir),
66     }
67 }
68
69 MIDDLEWARE = (
70     'django.middleware.common.CommonMiddleware',
71     'django.contrib.sessions.middleware.SessionMiddleware',
72     'django.contrib.auth.middleware.AuthenticationMiddleware',
73     'django.contrib.messages.middleware.MessageMiddleware',
74     'django.middleware.csrf.CsrfViewMiddleware',
75 )
76
77 ROOT_URLCONF = 'sommitrealweird.urls'
78
79 TEMPLATES = [
80     {
81         'BACKEND': 'django.template.backends.django.DjangoTemplates',
82         'DIRS': [os.path.join(topdir, 'templates'),],
83         'APP_DIRS': True,
84         'OPTIONS': {
85             'context_processors': [
86                 'django.template.context_processors.request',
87                 'django.contrib.auth.context_processors.auth',
88                 'django.contrib.messages.context_processors.messages',
89                 'django.template.context_processors.debug',
90                 'django.template.context_processors.i18n',
91                 'django.template.context_processors.media',
92                 'sommitrealweird.bpcms.context_processors.content_menu',
93                 'sommitrealweird.bpcms.context_processors.content_submenu',
94                 'sommitrealweird.bpcms.context_processors.content_breadcrumb',
95                 'sommitrealweird.blog.context_processors.content_breadcrumb',
96                 'sommitrealweird.blog.context_processors.blog_feed',
97                 'sommitrealweird.photo.context_processors.content_breadcrumb',
98             ],
99             'debug': True,
100         },
101     },
102 ]
103
104 INSTALLED_APPS = (
105     'django.contrib.auth',
106     'django.contrib.contenttypes',
107     'django.contrib.sessions',
108     'django.contrib.sites',
109     'django.contrib.admin',
110     'django.contrib.messages',
111     'sommitrealweird.bpcms',
112     'sommitrealweird.generic',
113     'sommitrealweird.blog',
114     'sommitrealweird.photo',
115 )
116
117
118 APPEND_SLASH=False
119
120 RESTRUCTUREDTEXT_FILTER_SETTINGS = {
121     'initial_header_level': 2,
122     'doctitle_xform': False,
123 }
124
125 BPCMS_ROOT = '/'
126 BPCMS_DISALLOWED_ROOT_DOC_NAMES = (
127     'admin',
128     'blog',
129     'photos',
130 )
131
132 BLOG_ROOT = '/blog/'
133 BLOG_TITLE = u'The World of SommitRealWeird.'
134 BLOG_FEED_ROOT = '/feeds/blog/'
135
136 try:
137     from localsettings import *
138 except:
139     pass
140