root/trunk/pylucid_project/PyLucid/settings_example.py

Revision 2342, 15.3 KB (checked in by JensDiemer, 5 months ago)

use MAIN_APP_PATH for INSTALL_DATA_DIR, too.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Rev LastChangedDate
Line 
1# -*- coding: utf-8 -*-
2"""
3    PyLucid.settings-example
4    ~~~~~~~~~~~~~~~~~~~~~~~~
5
6    Django settings for the PyLucid project.
7
8    1. You must copy this file:
9            settings_example.py -> settings.py
10    2. Change the basic settings.
11        At least this: Database, _install section and middleware classes.
12
13    Note, you must edit MIDDLEWARE_CLASSES, after installation!!!
14
15    Here are not all settings predifined you can use. Please look at the
16    django documentation for a full list of all items:
17        http://www.djangoproject.com/documentation/settings/
18
19    Last commit info:
20    ~~~~~~~~~~~~~~~~~
21    $LastChangedDate$
22    $Rev$
23    $Author$
24
25    :copyleft: 2007 by the PyLucid team, see AUTHORS for more details.
26    :license: GNU GPL v3 or above, see LICENSE for more details.
27"""
28
29import os
30
31
32"""
33_______________________________________________________________________________
34 The Base settings, you should change:
35"""
36
37MAIN_APP_PATH = os.path.dirname(__file__)
38
39#______________________________________________________________________________
40# DATABASE SETUP
41
42# Database connection info.
43DATABASE_ENGINE = 'sqlite3'    # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
44DATABASE_NAME = 'PyLucid.db3'  # Or path to database file if using sqlite3.
45DATABASE_USER = ''             # Not used with sqlite3.
46DATABASE_PASSWORD = ''         # Not used with sqlite3.
47DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
48DATABASE_PORT = ''             # Set to empty string for default. Not used with sqlite3.
49
50# Example for MySQL:
51#DATABASE_ENGINE = 'mysql'
52#DATABASE_NAME = 'DatabaseName'
53#DATABASE_USER = 'UserName'
54#DATABASE_PASSWORD = 'Password'
55#DATABASE_HOST = 'localhost'
56#DATABASE_PORT = '' # empty string for default port.
57
58
59#_____________________________________________________________________________
60# DEBUGGING
61
62# deactivate the DEBUG mode in a productive environment because there a many
63# information in a debug traceback ;)
64# You should always use INTERNAL_IPS to limit the access!
65DEBUG = True
66
67# Tuple of IP addresses, as strings, that:
68#   * See debug comments, when DEBUG is true
69#   * Receive x-headers
70INTERNAL_IPS = ("localhost", "127.0.0.1")
71
72#_____________________________________________________________________________
73# _INSTALL SECTION
74
75# Install Password to login into the _install section.
76ENABLE_INSTALL_SECTION = True
77INSTALL_PASSWORD_HASH = ""
78
79#_____________________________________________________________________________
80# MIDDLEWARE CLASSES
81
82# List of middleware classes to use.  Order is important; in the request phase,
83# this middleware classes will be applied in the order given, and in the
84# response phase the middleware will be applied in reverse order.
85#
86MIDDLEWARE_CLASSES = (
87    # Insert a statistic line into the generated page:
88    'PyLucid.middlewares.pagestats.PageStatsMiddleware',
89
90    'PyLucid.middlewares.pagemessages.PageMessagesMiddleware',
91
92    # PyLucidCommonMiddleware loads the django middlewares:
93    #    - 'django.contrib.sessions.middleware.SessionMiddleware'
94    #    - 'django.contrib.auth.middleware.AuthenticationMiddleware'
95    #    - 'django.middleware.locale.LocaleMiddleware'
96    'PyLucid.middlewares.common.PyLucidCommonMiddleware',
97
98    # Cache all anonymous cms page request, if CACHE_BACKEND worked.
99    'PyLucid.middlewares.cache.CacheMiddleware',
100
101    'django.middleware.common.CommonMiddleware',
102    'django.middleware.doc.XViewMiddleware',
103
104    # Add a human readable anchor to every html headline:
105    'PyLucid.middlewares.headline_anchor.HeadlineAnchor',
106)
107
108# A secret key for this particular Django installation. Used in secret-key
109# hashing algorithms. Set this in your settings, or Django will complain
110# loudly.
111# Make this unique, and don't share it with anybody.
112SECRET_KEY = ''
113
114#_____________________________________________________________________________
115# CACHE
116#
117# http://www.djangoproject.com/documentation/cache/
118#
119# In PyLucid every normal cms page request would be cached for anonymous users.
120# For this cms page cache a working cache backend is needed.
121#
122# Note:
123#    -You can test available backends in the _install section!
124#    -You should use a unique filesystem cache dir!
125#
126# Dummy caching ('dummy:///'):
127#    The default non-caching. It just implements the cache interface without
128#    doing anything.
129#
130# Database caching:
131#    You must create the cache tables manually in the shell. Look at the django
132#    cache documentation!
133#
134# Filesystem caching (e.g. 'file:///tmp'):
135#    Usefull if memcache is not available. You should check if it allowed to
136#    make temp files! You can test this in the PyLucid _install section!
137#
138# Local-memory caching ('locmem:///'):
139#    Not useable with CGI! Every Request starts with a empty cache ;)
140#    Waring: On shared webhosting, the available memory can be limited.
141#
142# Simple caching ('simple:///'):
143#    It should only be used in development or testing environments.
144
145# Default: "dummy:///" # (No caching)
146CACHE_BACKEND = "dummy:///"
147
148# The number of seconds each cms page should be cached.
149CACHE_MIDDLEWARE_SECONDS = 600
150
151#_____________________________________________________________________________
152# STATIC FILES
153# http://www.djangoproject.com/documentation/static_files/
154
155# Serve static files for the development server?
156# Using this method is inefficient and insecure.
157# Do not use this in a production setting. Use this only for development.
158SERVE_STATIC_FILES = False
159
160# Note: Every URL/path...
161# ...must be a absolute path.
162# ...must have a trailing slash.
163
164# Absolute _local_filesystem_path_ to the directory that holds media.
165#     Example-1: "./media/" (default)
166#     Example-2: "/home/foo/htdocs/media/"
167MEDIA_ROOT = "./media/"
168
169# URL that handles the media served from MEDIA_ROOT.
170#     Example-1: "/media/" (default)
171#     Examlpe-2: "http://other_domain.net/media/"
172#     Example-3: "http://media.your_domain.net/"
173MEDIA_URL = "/media/"
174
175# URL prefix for admin media -- CSS, JavaScript and images.
176#     Examples-1: "/django/contrib/admin/media/" (default)
177#     Examples-2: "http://other_domain.net/media/django/"
178#     Examples-3: "http://django.media.your_domain.net/"
179ADMIN_MEDIA_PREFIX = "/django/contrib/admin/media/"
180
181# Base path for all filesystem bases plugins, e.g. Filemanager, Gallery
182# The dict key would be inserted into the url.
183# Every item is a tupel containing the filesystem path and the url.
184# You can add more path, if you need them!
185FILESYSTEM_BASEPATHS = {
186    "media": (MEDIA_ROOT, MEDIA_URL),
187    # "downloads": ("/var/www/media/downloads/", "/downloads/"),
188    # "my files": ("./my_static_files/", "http://static.your_domain.net/"),
189    # ...
190}
191
192"""
193_______________________________________________________________________________
194 Advanced settings:
195"""
196
197# People who get code error notifications.
198# In the format (('Full Name', 'email@domain.com'), ('Full Name', 'anotheremail@domain.com'))
199ADMINS = (
200    # ('Your Name', 'your_email@domain.com'),
201)
202
203# Not-necessarily-technical managers of the site. They get broken link
204# notifications and other various e-mails.
205MANAGERS = ADMINS
206
207#_____________________________________________________________________________
208# 404 BEHAVIOR
209
210# tuple of strings that specify URLs that should be ignored by the 404 e-mailer.
211# http://www.djangoproject.com/documentation/settings/#ignorable-404-ends
212IGNORABLE_404_STARTS = ('/cgi-bin/',)
213IGNORABLE_404_ENDS = ('favicon.ico', '.php')
214
215#_____________________________________________________________________________
216# I80N
217# http://www.djangoproject.com/documentation/i18n/
218
219# Local time zone for this installation. All choices can be found here:
220# http://www.postgresql.org/docs/current/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
221TIME_ZONE = 'America/Chicago'
222
223
224# Language code for this installation. All choices can be found here:
225# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
226# http://blogs.law.harvard.edu/tech/stories/storyReader$15
227LANGUAGE_CODE = 'en-us'
228
229#_____________________________________________________________________________
230# EMAIL
231# http://www.djangoproject.com/documentation/email/
232
233# Default e-mail address to use for various automated correspondence
234# Replace with a normal String like:
235# DEFAULT_FROM_EMAIL = "webmaster@example.org"
236DEFAULT_FROM_EMAIL = "webmaster@" + os.environ.get("HTTP_HOST", "localhost")
237
238# Host for sending e-mail.
239EMAIL_HOST = 'localhost'
240
241# Port for sending e-mail.
242EMAIL_PORT = 25
243
244# Subject-line prefix for email messages send with django.core.mail.mail_admins
245# or ...mail_managers.  Make sure to include the trailing space.
246EMAIL_SUBJECT_PREFIX = '[PyLucid] '
247
248
249#_____________________________________________________________________________
250# SESSIONS
251
252SESSION_COOKIE_NAME = 'sessionid'         # Cookie name. This can be whatever you want.
253SESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 2 # Age of cookie, in seconds (default: 2 weeks).
254SESSION_COOKIE_DOMAIN = None              # A string like ".lawrence.com", or None for standard domain cookie.
255SESSION_COOKIE_SECURE = False             # Whether the session cookie should be secure (https:// only).
256SESSION_SAVE_EVERY_REQUEST = False        # Whether to save the session data on every request.
257SESSION_EXPIRE_AT_BROWSER_CLOSE = False   # Whether sessions expire when a user closes his browser.
258
259
260#_____________________________________________________________________________
261# TEMPLATE SYSTEM
262
263# A tuple of callables that know how to import templates from various sources.
264TEMPLATE_LOADERS = (
265    'django.template.loaders.filesystem.load_template_source',
266    'django.template.loaders.app_directories.load_template_source',
267#     'django.template.loaders.eggs.load_template_source',
268)
269
270# A tuple of callables that are used to populate the context in RequestContext.
271# These callables take a request object as their argument and return a
272# dictionary of items to be merged into the context.
273TEMPLATE_CONTEXT_PROCESSORS = (
274    "django.core.context_processors.auth",
275    "django.core.context_processors.debug",
276    "django.core.context_processors.i18n",
277    "django.core.context_processors.request",
278    "PyLucid.system.context_processors.static",
279)
280
281# A tuple of locations of the template source files, in search order. Note that
282# these paths should use Unix-style forward slashes, even on Windows.
283TEMPLATE_DIRS = (
284    "PyLucid/templates_django", "PyLucid/templates_PyLucid",
285)
286
287# A boolean that turns on/off template debug mode. If this is True, the fancy
288# error page will display a detailed report for any TemplateSyntaxError.
289# Note that Django only displays fancy error pages if DEBUG is True!
290TEMPLATE_DEBUG = DEBUG
291
292if TEMPLATE_DEBUG:
293    # Display invalid (e.g. misspelled, unused) template variables
294    # http://www.djangoproject.com/documentation/templates_python/#how-invalid-variables-are-handled
295    # http://www.djangoproject.com/documentation/settings/#template-string-if-invalid
296    TEMPLATE_STRING_IF_INVALID = "XXX INVALID TEMPLATE STRING '%s' XXX"
297
298#_____________________________________________________________________________
299# APP CONFIG
300
301
302# A string representing the full Python import path to the PyLucid root URLconf.
303ROOT_URLCONF = 'PyLucid.urls'
304
305# A tuple of strings designating all applications that are enabled in this
306# Django installation. Each string should be a full Python path to a Python
307# package that contains a Django application
308INSTALLED_APPS = (
309    'django.contrib.auth',
310    'django.contrib.contenttypes',
311    'django.contrib.sessions',
312    'django.contrib.sites',
313    'django.contrib.admin',
314    "PyLucid",
315    "PyLucid.system.PyLucidPlugins",
316)
317
318
319#_____________________________________________________________________________
320# PYLUCID BASE SETTINGS
321# basic adjustments, witch don't have to be changed.
322
323# All PyLucid media files stored in a sub directory under the django media
324# path. Used for building filesystem path and URLs.
325# filesystem path: MEDIA_ROOT + PYLUCID_MEDIA_SUBDIR
326# URLs: MEDIA_URL + PYLUCID_MEDIA_SUBDIR
327PYLUCID_MEDIA_DIR = "PyLucid"
328
329# Sub directory name for all default internal pages. It would be used to build
330# the filesystem path and the URL!
331# filesystem path: MEDIA_ROOT + PYLUCID_MEDIA_SUBDIR + INTERNAL_PAGE_PATH
332# URLs: MEDIA_URL + PYLUCID_MEDIA_SUBDIR + INTERNAL_PAGE_PATH
333INTERNAL_PAGE_DIR = "internal_page"
334
335# If you will change a internal page, you must copy a file from
336# INTERNAL_PAGE_PATH into this directory. (Same subdirectory!)
337# (default: "custom")
338# filesystem path: MEDIA_ROOT + PYLUCID_MEDIA_SUBDIR + CUSTOM_INTERNAL_PAGE_PATH
339# URLs: MEDIA_URL + PYLUCID_MEDIA_SUBDIR + CUSTOM_INTERNAL_PAGE_PATH
340CUSTOM_INTERNAL_PAGE_DIR = "custom"
341
342
343# Path to the Plugins
344PLUGIN_PATH = (
345    {
346        "type": "internal",
347        "path": ("PyLucid", "plugins_internal"),
348        "auto_install": True,
349    },
350    {
351        "type": "external",
352        "path": ("PyLucid", "plugins_external"),
353        "auto_install": False,
354    },
355)
356
357# special URL prefixes:
358
359# Prefix for the install section
360INSTALL_URL_PREFIX = "_install"
361# Prefix for every command request
362COMMAND_URL_PREFIX = "_command"
363# Prefix to the django admin panel
364ADMIN_URL_PREFIX = "_admin"
365# the redirect to the real page url
366PERMALINK_URL_PREFIX = "_goto"
367
368
369# static URLs (used in Traceback messages)
370
371# The PyLucid install instrucion page:
372INSTALL_HELP_URL = "http://pylucid.org/_goto/107/install-PyLucid/"
373
374# How are the DB initial database data stored?
375INSTALL_DATA_DIR = os.path.join(MAIN_APP_PATH, 'db_dump_datadir')
376
377# PyLucid cache prefix
378PAGE_CACHE_PREFIX = "PyLucid_page_cache_"
379
380# Additional Data Tag
381# A temporary inserted Tag for Stylesheet and JavaScript data from the internal
382# pages. Added by PyLucid.plugins_internal.page_style and replaces in
383# PyLucid.index._replace_add_data()
384ADD_DATA_TAG = "<!-- additional_data -->"
385
386# JS-SHA1-Login Cookie name
387INSTALL_COOKIE_NAME = "PyLucid_inst_auth"
388
389# http://www.djangoproject.com/documentation/authentication/#other-authentication-sources
390AUTHENTICATION_BACKENDS = (
391    "django.contrib.auth.backends.ModelBackend",
392    "PyLucid.plugins_internal.auth.auth_backend.JS_SHA_Backend",
393)
394
395# Unit test runner
396TEST_RUNNER = 'tests.run_tests'
397
398#_____________________________________________________________________________
399# CHANGEABLE PYLUCID SETTINGS
400
401# Enable the _install Python Web Shell Feature?
402# Should be only enabled for tests. It is a big security hole!
403INSTALL_EVILEVAL = False
404
405# Permit sending mails with the EMailSystem Plugin:
406ALLOW_SEND_MAILS = True
407
408# Every Plugin output gets a html SPAN tag around.
409# Here you can defined witch CSS class name the tag should used:
410CSS_PLUGIN_CLASS_NAME = "PyLucidPlugins"
411
412# A tuple list of all plugins witch output should not surrounded with a
413# <div> tag:
414CSS_TAG_BLACKLIST = ("page_style", "RSSfeedGenerator",)
415
416
417# The table prefix from a old PyLucid installation, if exist.
418# Only used for updating!
419# Note: The OLD_TABLE_PREFIX can't be "PyLucid"!!!
420OLD_TABLE_PREFIX = ""
421# How to update a old v0.7.2 installation:
422# 1. Backup you old installation (Save a SQL dump)!
423# 2. init a fresh PyLucid installation. Follow the normal install steps:
424# 2.1. install Db tables
425# 2.2. init DB data
426# 2.3. install internal plugins
427# 3. convert the old content to the new installation:
428# 3.1. update DB tables from v0.7.2 to django PyLucid v0.8
429# 3.2. update to the new django template engine
430# Use "low level admin/User administration" to set a new password for the user.
431
432# If you used a old PyLucid installation then you can recirect the old
433# urls with "indey.py" to the new URLs without the "index.py" part.
434# Default: False
435REDIRECT_OLD_PYLUCID_URL = False
Note: See TracBrowser for help on using the browser.