Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1""" 

2Django settings for project project. 

3 

4Generated by 'django-admin startproject' using Django 3.0.4. 

5 

6For more information on this file, see 

7https://docs.djangoproject.com/en/3.0/topics/settings/ 

8 

9For the full list of settings and their values, see 

10https://docs.djangoproject.com/en/3.0/ref/settings/ 

11""" 

12 

13import os 

14 

15# Build paths inside the project like this: os.path.join(BASE_DIR, ...) 

16import sys 

17from typing import Sequence 

18 

19BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 

20MEDIA_ROOT = BASE_DIR 

21 

22 

23# Quick-start development settings - unsuitable for production 

24# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ 

25 

26# SECURITY WARNING: don't run with debug turned on in production! 

27DEBUG = False 

28 

29ALLOWED_HOSTS: Sequence[str] = [] 

30 

31 

32# Application definition 

33 

34INSTALLED_APPS = [ 

35 'django.contrib.admin', 

36 'django.contrib.auth', 

37 'django.contrib.contenttypes', 

38 'django.contrib.sessions', 

39 'django.contrib.messages', 

40 'django.contrib.staticfiles', 

41 'rest_framework', 

42 'rest_framework.authtoken', 

43 'jutil', 

44] 

45 

46MIDDLEWARE = [ 

47 'django.middleware.security.SecurityMiddleware', 

48 'django.contrib.sessions.middleware.SessionMiddleware', 

49 'django.middleware.common.CommonMiddleware', 

50 'django.middleware.csrf.CsrfViewMiddleware', 

51 'django.contrib.auth.middleware.AuthenticationMiddleware', 

52 'django.contrib.messages.middleware.MessageMiddleware', 

53 'django.middleware.clickjacking.XFrameOptionsMiddleware', 

54] 

55 

56ROOT_URLCONF = 'project.urls' 

57 

58TEMPLATES = [ 

59 { 

60 'BACKEND': 'django.template.backends.django.DjangoTemplates', 

61 'DIRS': [], 

62 'APP_DIRS': True, 

63 'OPTIONS': { 

64 'context_processors': [ 

65 'django.template.context_processors.debug', 

66 'django.template.context_processors.request', 

67 'django.contrib.auth.context_processors.auth', 

68 'django.contrib.messages.context_processors.messages', 

69 ], 

70 }, 

71 }, 

72] 

73 

74WSGI_APPLICATION = 'project.wsgi.application' 

75 

76# Logging 

77 

78LOGGING = { 

79 'version': 1, 

80 'disable_existing_loggers': False, 

81 'filters': { 

82 'ndebug': { 

83 '()': 'django.utils.log.RequireDebugFalse', 

84 }, 

85 }, 

86 'formatters': { 

87 'verbose': { 

88 'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s", 

89 'datefmt' : "%Y-%m-%d %H:%M:%S" 

90 }, 

91 'simple': { 

92 'format': '%(levelname)s %(message)s' 

93 }, 

94 }, 

95 'handlers': { 

96 'file': { 

97 'level': 'DEBUG', 

98 'class': 'logging.FileHandler', 

99 'filename': os.path.join(BASE_DIR, 'logs/django.log'), 

100 'formatter': 'verbose' 

101 }, 

102 'console': { 

103 'class': 'logging.StreamHandler', 

104 'stream': sys.stdout, 

105 } 

106 }, 

107 'loggers': { 

108 'jutil': { 

109 'handlers': ['file', 'console'], 

110 'level': 'DEBUG', 

111 }, 

112 'django': { 

113 'handlers': ['file', 'console'], 

114 'level': 'WARNING', 

115 }, 

116 } 

117} 

118 

119# Password validation 

120# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators 

121 

122AUTH_PASSWORD_VALIDATORS = [ 

123 { 

124 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 

125 }, 

126 { 

127 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 

128 }, 

129 { 

130 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 

131 }, 

132 { 

133 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 

134 }, 

135] 

136 

137 

138# Internationalization 

139# https://docs.djangoproject.com/en/3.0/topics/i18n/ 

140 

141LANGUAGE_CODE = 'en-us' 

142 

143TIME_ZONE = 'UTC' 

144 

145USE_I18N = True 

146 

147USE_L10N = True 

148 

149USE_TZ = True 

150 

151LOCALE_PATHS = ( 

152 os.path.join(BASE_DIR, 'jutil/locale'), 

153) 

154 

155 

156# Static files (CSS, JavaScript, Images) 

157# https://docs.djangoproject.com/en/3.0/howto/static-files/ 

158 

159STATIC_URL = '/static/' 

160STATIC_ROOT = os.path.join(BASE_DIR, 'static') 

161 

162STATICFILES_DIRS: Sequence[str] = [ 

163] 

164STATICFILES_FINDERS: Sequence[str] = ( 

165 'django.contrib.staticfiles.finders.FileSystemFinder', 

166 'django.contrib.staticfiles.finders.AppDirectoriesFinder' 

167) 

168 

169# XML formatting 

170XMLLINT_PATH = '/usr/bin/xmllint'