-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbase_settings.py
280 lines (244 loc) · 12.2 KB
/
base_settings.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
#
# Quru Image Server
#
# Base server settings (production settings)
#
# Do not edit this file - it will be overwritten when you upgrade the package.
#
# These settings can instead be overridden by creating the file
# <base>/conf/local_settings.py and adding entries there instead.
#
# The server's public/external host name (and optionally port).
# E.g. "images.example.com" or "images.example.com:8080"
# or "" for automatic host name and port detection.
PUBLIC_HOST_NAME = ""
# The deployment path of the application on the server.
# This also defaults the session cookie path.
APPLICATION_ROOT = "/"
# Whether to default image URLs to http or https
PREFERRED_URL_SCHEME = "http"
# Benchmark mode (do not enable this in production)
BENCHMARKING = False
# Session encryption key. Set your own in local_settings.py and KEEP IT SECRET!
SECRET_KEY = "\xc7\x9b\xed9Q\x89\xb0\x19\xad\x80\x85+r\xaat:U#\x9bi\xc9\x99zY"
# Which imaging back-end to load (new in v4.0).
# Use 'pillow' for basic imaging, 'imagemagick' for premium imaging
# (requires qismagick.so), or 'auto' for automatic detection/selection.
IMAGE_BACKEND = 'auto'
# Allowed image types, in the format {file extension: (name, mime type), ...}.
# Only the image types in this list will be allowed to be uploaded and displayed
# in the admin area. Note it is the imaging back-end that determines which formats
# are actually supported. In the case of ImageMagick, the build flags and installed
# delegate libraries also affect this (e.g. how well SVG is supported).
IMAGE_FORMATS = {
# Common image files - Pillow or ImageMagick
"gif": ("GIF image", "image/gif"),
"jpg": ("JPEG image", "image/jpeg"),
"jpe": ("JPEG image", "image/jpeg"),
"jfif": ("JPEG image", "image/jpeg"),
"jif": ("JPEG image", "image/jpeg"),
"jpeg": ("JPEG image", "image/jpeg"),
"pjpg": ("Progressive JPEG image", "image/jpeg"), # virtual format
"pjpeg": ("Progressive JPEG image", "image/jpeg"), # virtual format
"png": ("PNG image", "image/png"),
"tif": ("TIFF image", "image/tiff"),
"tiff": ("TIFF image", "image/tiff"),
# Extra image files - requires qismagick.so
"bmp": ("Bitmap image", "image/bmp"),
"dcm": ("DICOM image", "application/dicom"),
"eps": ("Encapsulated PostScript", "application/postscript"),
"ico": ("Microsoft icon", "image/x-icon"),
"pdf": ("PDF file", "application/pdf"),
"ppm": ("Portable PixMap image", "image/x-portable-pixmap"),
"psd": ("Photoshop image", "image/psd"),
"svg": ("SVG image", "image/svg+xml"),
"tga": ("Truevision TARGA image", "image/tga"),
"xcf": ("GIMP image", "image/xcf"),
# RAW image files - requires qismagick.so
"arw": ("Sony Alpha RAW image", "image/arw"),
"cr2": ("Canon RAW image", "image/cr2"),
"mrw": ("Minolta RAW image", "image/mrw"),
"nef": ("Nikon RAW image", "image/nef"),
"nrw": ("Nikon RAW image", "image/nrw"),
"orf": ("Olympus RAW image", "image/orf"),
"rw2": ("Panasonic RAW image", "image/rw2"),
"raw": ("Panasonic RAW image", "image/raw"),
"raf": ("Fuji RAW image", "image/raf"),
"x3f": ("Sigma RAW image", "image/x3f"),
}
# Resize algorithm (1 fastest/good, 2 better, 3 slowest/best)
IMAGE_RESIZE_QUALITY = 3
# Whether to gamma correct sRGB images when resizing. Should be True for the
# best image quality. Adds a small overhead with the ImageMagick back-end but
# incurs a heavy performance penalty with the Pillow back-end.
IMAGE_RESIZE_GAMMA_CORRECT = True
# Maximum image width/height parameter value to accept
# E.g. 15k x 15k x 32bpp = 900MB memory required for processing
MAX_IMAGE_DIMENSION = 15000
# Maximum grid size when producing tiles (must be a power of 2)
MAX_GRID_TILES = 256
# Optional width and/or height limits to enforce for public-facing images,
# e.g. to prevent people requesting large versions of thumbnail images.
# Use a value of 0 to allow images to be requested at any size.
# When non-zero, do not set these lower than 1000 if using the HTML5 zoom
# viewer or gallery viewer. Also note: image templates that define a larger
# width or height will take precedence over these values.
PUBLIC_MAX_IMAGE_WIDTH = 0
PUBLIC_MAX_IMAGE_HEIGHT = 0
# The image pixel area beyond which the server may choose to automatically create
# resized smaller versions of the image, to speed up future imaging operations.
# Values below 1000000 (1 megapixel) will be ignored and disable this feature.
AUTO_PYRAMID_THRESHOLD = 10000000
# The maximum time in seconds to wait for another client to finish generating
# the requested image before either returning a "server too busy" error or
# going on to generate a duplicate image. Allowed range 10 to 120 seconds.
# Note that this value must be less than the timeouts that are also defined
# at the mod_wsgi (v4.1+) and Apache/Nginx software layers.
IMAGE_GENERATION_WAIT_TIMEOUT = 30
# Whether to return a "server too busy" error when IMAGE_GENERATION_WAIT_TIMEOUT
# is reached. If False, the client should eventually receive the requested image,
# but the server may be subjected to a significant load spike.
IMAGE_GENERATION_RAISE_TOO_BUSY = True
# Whether to automatically background-convert PDF files into images,
# by creating a sub-folder and a PNG image file for each page.
PDF_BURST_TO_PNG = True
# The target DPI value to use when converting PDF pages to images.
# Larger values result in larger images.
PDF_BURST_DPI = 150
# Files types to treat as PDF
PDF_FILE_TYPES = ['pdf', 'ps', 'eps', 'epsi', 'epsf']
# An image path (relative to IMAGES_BASE_DIR) for the image to use as the
# application logo, or an empty string to use the default logo.
LOGO_IMAGE_PATH = ""
# An image path or folder path (relative to IMAGES_BASE_DIR) that contains the
# image (or folder of images) to use for the public demo page at URL /demo/
# The image(s) must be publicly viewable. An empty string disables the demo page.
DEMO_IMAGE_PATH = ""
# An image path (relative to IMAGES_BASE_DIR) of an image to use for the demo
# overlay on the public demo page. The image must be publicly viewable.
# An empty string disables the overlay demo.
DEMO_OVERLAY_IMAGE_PATH = ""
# Image upload directories available for selection from the upload page.
# These should be relative to IMAGES_BASE_DIR and will be created at file upload
# time if they do not exist. You may optionally include date and time placeholders
# as described for Python's 'strftime' function (current UTC time will be applied).
# Use format (display name, relative image path).
# E.g. ("Today's snaps", "%Y-%m-%d snaps") will at the time of writing create
# image folder /images/2011-06-14 snaps/ for an IMAGES_BASE_DIR of /images
IMAGE_UPLOAD_DIRS = [
("Today's images", "%Y-%m-%d"),
("Sample images", "samples")
]
# A template to suggest in the example HTML snippet for the uploaded image
# (or an empty string for none)
IMAGE_UPLOADED_TEMPLATE = ""
# Maximum upload size in bytes
# For multi-file uploads, this is the maximum size of all files combined
MAX_CONTENT_LENGTH = 1024 * 1024 * 1024
# Full paths to the application files.
# All images must lie within the path given by IMAGES_BASE_DIR. This can
# point to any path that has read+write access for the application user.
INSTALL_DIR = "/opt/qis/"
DOCS_BASE_DIR = INSTALL_DIR + "doc/"
ICC_BASE_DIR = INSTALL_DIR + "icc/"
IMAGES_BASE_DIR = INSTALL_DIR + "images/"
LOGGING_BASE_DIR = INSTALL_DIR + "logs/"
# The directory to store published portfolios in, inside IMAGES_BASE_DIR.
# Prefix the name with a single dot/period to hide it in the admin interface.
FOLIO_EXPORTS_DIR = ".folio_exports"
# A path where temporary imaging files can be created, or an empty string to
# use the operating system's default directory (e.g. "/tmp").
TEMP_DIR = ""
# Whether to allow alphanumeric unicode characters in filenames.
# If False, all file names are coerced to the nearest ASCII equivalents.
ALLOW_UNICODE_FILENAMES = True
# Permissions to apply when creating images and directories.
# Applicable to *nix platforms only. The system umask is ignored.
# File default is 0o644 (rw-r--r--).
IMAGES_FILE_MODE = 0o644
# Directory default is 0o755 (rwxr-xr-x).
IMAGES_DIR_MODE = 0o755
# The logging server's name or IP address, or an empty string "" to disable logging
LOGGING_SERVER = "localhost"
# The logging server port
LOGGING_SERVER_PORT = 9002
# The stats server's name or IP address, or an empty string "" to disable statistics
STATS_SERVER = "localhost"
# The logging server port
STATS_SERVER_PORT = 9003
# The granularity of recorded image statistics, in minutes (approximate, minimum 5)
STATS_FREQUENCY = 60
# The number of days to keep statistics for before deleting them.
# Set to 0 to disable the automatic deletion of old statistics.
STATS_KEEP_DAYS = 365
# The task server's name or IP address
TASK_SERVER = "localhost"
# The task server port
TASK_SERVER_PORT = 9004
# The number of task processing threads to create (note CPython's GIL)
TASK_SERVER_THREADS = 5
# The memcached server(s) to use, as a list
MEMCACHED_SERVERS = ["127.0.0.1:11211"]
# The cache management database
CACHE_DATABASE_CONNECTION = "postgresql+psycopg2:///qis-cache"
CACHE_DATABASE_POOL_SIZE = 5 # (per Apache process)
# The image management database
# Local: postgresql+psycopg2:///qis-mgmt
# Remote: postgresql+psycopg2://dbuser:[email protected]:5432/qis-mgmt
MGMT_DATABASE_CONNECTION = "postgresql+psycopg2:///qis-mgmt"
MGMT_DATABASE_POOL_SIZE = 5 # (per Apache process)
# If the application is hosted behind a load balancer or a reverse proxy server,
# set this value to the number of servers that sit in front (usually just 1).
# This is required to log the IP address of clients instead of the proxy server's
# IP address, and to prevent redirection loops when the proxy server handles
# HTTPS externally but uses plain HTTP internally.
PROXY_SERVERS = 0
# The HTTP port to restrict the API, login, file browsing and administration
# web pages to, or 0 to use the standard web browsing ports. Requires Apache/
# Nginx to also be servicing the application on this port when non-zero.
INTERNAL_BROWSING_PORT = 0
# Whether to require HTTPS for the API, login, and administration web pages
# to prevent eavesdropping and session hijacking (requires an installed SSL certificate)
INTERNAL_BROWSING_SSL = True
# Session cookie settings
SESSION_COOKIE_NAME = 'session'
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_SECURE = INTERNAL_BROWSING_SSL
# The type of authentication used by the REST API.
# Currently "TimedTokenBasicAuthentication" is the only value allowed.
API_AUTHENTICATION_CLASS = "TimedTokenBasicAuthentication"
# The API token expiry time in seconds.
API_TOKEN_EXPIRY_TIME = 60 * 60
# The path to the Ghostscript command to use for PDF file processing.
# This can be simply "gs" to use the server's default installation.
GHOSTSCRIPT_PATH = "gs"
# Whether to integrate with an LDAP or Active Directory server
# for the provision of user accounts and login authentication.
# All other LDAP settings are ignored when LDAP_INTEGRATION is False.
LDAP_INTEGRATION = False
# The directory service type, one from:
# "OpenLDAPPosix", "OpenLDAPOrganizational", "Apple", "ActiveDirectory".
LDAP_SERVER_TYPE = ""
# The LDAP/AD server's name or IP address
LDAP_SERVER = ""
# Whether to use a secure connection with TLS / LDAPS.
# Requires OpenSSL, GnuTLS or MozNSS (and possibly further configuration there).
LDAP_SECURE = False
# The base tree level to use when querying the directory.
# E.g. LDAP "cn=users,dc=ldap,dc=mycompany,dc=com"
# E.g. ActiveDirectory "dc=mycompany,dc=com"
LDAP_QUERY_BASE = ""
# The distinguished name and password of an LDAP user account to use for
# querying the directory (only required for Active Directory).
# E.g. LDAP "uid=myuser,cn=users,dc=ldap,dc=mycompany,dc=com"
# E.g. ActiveDirectory "[email protected]"
LDAP_BIND_USER_DN = ""
LDAP_BIND_PASSWORD = ""
# Destination for sending anonymous usage data, once per 24 hours
USAGE_DATA_URL = 'https://qis.quru.com/collectstats'
# For use with the "xref" image parameter, a 3rd party URL that will be called
# (every time the image is requested) with the xref value appended to it.
# E.g. "http://www.example.com/trackid?id=", or "" to disable this feature.
# Note: Do not use a URL that refers back to this same server, otherwise
# a deadlock-type condition could occur when the server is very busy.
XREF_TRACKING_URL = ""