gremmie@1: # Django settings for gpp project. gremmie@1: gremmie@1: import os gremmie@1: import platform bgneal@38: from decimal import Decimal bgneal@38: import logging bgneal@38: gremmie@1: import local_settings bgneal@35: gremmie@1: project_path = os.path.abspath(os.path.split(__file__)[0]) gremmie@1: gremmie@1: DEBUG = local_settings.DEBUG gremmie@1: TEMPLATE_DEBUG = DEBUG gremmie@1: gremmie@1: ADMINS = ( gremmie@1: ('Brian Neal', 'admin@surfguitar101.com'), gremmie@1: ) gremmie@1: gremmie@1: AUTH_PROFILE_MODULE = 'bio.userprofile' gremmie@1: gremmie@1: MANAGERS = ADMINS gremmie@1: bgneal@173: DATABASES = local_settings.DATABASES gremmie@1: gremmie@1: INTERNAL_IPS = local_settings.INTERNAL_IPS gremmie@1: gremmie@1: # Local time zone for this installation. Choices can be found here: gremmie@1: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name gremmie@1: # although not all choices may be available on all operating systems. gremmie@1: # If running in a Windows environment this must be set to the same as your gremmie@1: # system time zone. gremmie@1: TIME_ZONE = local_settings.TIME_ZONE gremmie@1: gremmie@1: # Language code for this installation. All choices can be found here: gremmie@1: # http://www.i18nguy.com/unicode/language-identifiers.html gremmie@1: LANGUAGE_CODE = 'en-us' gremmie@1: gremmie@1: SITE_ID = local_settings.SITE_ID gremmie@1: gremmie@1: # If you set this to False, Django will make some optimizations so as not gremmie@1: # to load the internationalization machinery. gremmie@1: USE_I18N = False gremmie@1: gremmie@1: # Absolute path to the directory that holds media. gremmie@1: # Example: "/home/media/media.lawrence.com/" gremmie@1: MEDIA_ROOT = local_settings.MEDIA_ROOT gremmie@1: gremmie@1: # URL that handles the media served from MEDIA_ROOT. Make sure to use a gremmie@1: # trailing slash if there is a path component (optional in other cases). gremmie@1: # Examples: "http://media.lawrence.com", "http://example.com/media/" gremmie@1: MEDIA_URL = local_settings.MEDIA_URL gremmie@1: gremmie@1: # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a gremmie@1: # trailing slash. gremmie@1: # Examples: "http://foo.com/media/", "/media/". gremmie@1: ADMIN_MEDIA_PREFIX = local_settings.ADMIN_MEDIA_PREFIX gremmie@1: gremmie@1: # Make this unique, and don't share it with anybody. gremmie@1: SECRET_KEY = local_settings.SECRET_KEY gremmie@1: bgneal@174: # List of Loader classes that know how to import templates from various sources. bgneal@181: bgneal@181: if DEBUG: bgneal@181: TEMPLATE_LOADERS = ( bgneal@174: 'django.template.loaders.filesystem.Loader', bgneal@178: 'django.template.loaders.app_directories.Loader', bgneal@181: ) bgneal@181: else: bgneal@181: TEMPLATE_LOADERS = ( bgneal@181: ('django.template.loaders.cached.Loader', ( bgneal@181: 'django.template.loaders.filesystem.Loader', bgneal@181: 'django.template.loaders.app_directories.Loader', bgneal@181: )), bgneal@181: ) gremmie@1: bgneal@188: if DEBUG: bgneal@188: MIDDLEWARE_CLASSES = ( bgneal@188: 'django.middleware.common.CommonMiddleware', bgneal@194: 'django.middleware.csrf.CsrfViewMiddleware', bgneal@188: 'django.contrib.sessions.middleware.SessionMiddleware', bgneal@188: 'django.contrib.messages.middleware.MessageMiddleware', bgneal@188: 'debug_toolbar.middleware.DebugToolbarMiddleware', bgneal@188: 'django.contrib.auth.middleware.AuthenticationMiddleware', bgneal@215: 'gpp.core.middleware.InactiveUserMiddleware', bgneal@227: 'gpp.core.middleware.WhosOnline', bgneal@188: 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', bgneal@188: ) bgneal@188: else: bgneal@188: MIDDLEWARE_CLASSES = ( bgneal@188: 'django.middleware.common.CommonMiddleware', bgneal@194: 'django.middleware.csrf.CsrfViewMiddleware', bgneal@188: 'django.contrib.sessions.middleware.SessionMiddleware', bgneal@188: 'django.contrib.messages.middleware.MessageMiddleware', bgneal@188: 'django.contrib.auth.middleware.AuthenticationMiddleware', bgneal@215: 'gpp.core.middleware.InactiveUserMiddleware', bgneal@227: 'gpp.core.middleware.WhosOnline', bgneal@188: 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', bgneal@188: ) gremmie@1: gremmie@1: ROOT_URLCONF = 'gpp.urls' gremmie@1: gremmie@1: TEMPLATE_DIRS = ( gremmie@1: # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". gremmie@1: # Always use forward slashes, even on Windows. gremmie@1: # Don't forget to use absolute paths, not relative paths. gremmie@1: os.path.join(project_path, 'templates'), gremmie@1: ) gremmie@1: gremmie@1: TEMPLATE_CONTEXT_PROCESSORS = ( bgneal@178: "django.contrib.auth.context_processors.auth", bgneal@178: "django.core.context_processors.debug", bgneal@178: "django.core.context_processors.request", bgneal@178: "django.core.context_processors.media", bgneal@178: "django.contrib.messages.context_processors.messages", gremmie@1: ) gremmie@1: bgneal@188: INSTALLED_APPS = [ gremmie@1: 'django.contrib.admin', gremmie@1: 'django.contrib.admindocs', gremmie@1: 'django.contrib.auth', gremmie@1: 'django.contrib.contenttypes', bgneal@178: 'django.contrib.flatpages', bgneal@28: 'django.contrib.humanize', bgneal@178: 'django.contrib.markup', bgneal@178: 'django.contrib.messages', gremmie@1: 'django.contrib.sessions', gremmie@1: 'django.contrib.sites', bgneal@29: 'elsewhere', gremmie@1: 'tagging', bgneal@219: 'haystack', gremmie@1: 'accounts', bgneal@214: 'antispam', gremmie@1: 'bio', gremmie@1: 'bulletins', gremmie@1: 'comments', gremmie@1: 'contact', gremmie@1: 'core', bgneal@33: 'donations', gremmie@1: 'downloads', bgneal@75: 'forums', gremmie@1: 'gcalendar', gremmie@1: 'irc', bgneal@180: 'mailer', gremmie@1: 'membermap', gremmie@1: 'messages', gremmie@1: 'news', gremmie@1: 'podcast', gremmie@1: 'polls', gremmie@1: 'potd', gremmie@1: 'shoutbox', gremmie@1: 'smiley', gremmie@1: 'weblinks', bgneal@188: ] bgneal@188: if DEBUG: bgneal@188: INSTALLED_APPS.append('debug_toolbar') gremmie@1: gremmie@1: LOGIN_URL = '/accounts/login/' gremmie@1: LOGIN_REDIRECT_URL = '/profile/me/' gremmie@1: LOGOUT_URL = '/accounts/logout/' gremmie@1: bgneal@57: FILE_UPLOAD_PERMISSIONS = 0644 bgneal@80: DEFAULT_FROM_EMAIL = ADMINS[0][1] gremmie@1: gremmie@1: ####################################################################### bgneal@178: # Messages bgneal@178: ####################################################################### bgneal@178: MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage' bgneal@178: bgneal@178: ####################################################################### bgneal@180: # Email bgneal@180: ####################################################################### bgneal@180: EMAIL_HOST = local_settings.EMAIL_HOST bgneal@180: EMAIL_PORT = local_settings.EMAIL_PORT bgneal@180: bgneal@180: ####################################################################### bgneal@43: # Caching bgneal@43: ####################################################################### bgneal@43: if local_settings.USE_CACHE: bgneal@43: CACHE_BACKEND = local_settings.CACHE_BACKEND bgneal@248: CACHE_MIDDLEWARE_SECONDS = local_settings.CACHE_MIDDLEWARE_SECONDS bgneal@248: CACHE_MIDDLEWARE_KEY_PREFIX = local_settings.CACHE_MIDDLEWARE_KEY_PREFIX bgneal@248: CACHE_MIDDLEWARE_ANONYMOUS_ONLY = local_settings.CACHE_MIDDLEWARE_ANONYMOUS_ONLY bgneal@43: bgneal@43: ####################################################################### bgneal@189: # Sessions bgneal@189: ####################################################################### bgneal@189: SESSION_ENGINE = "django.contrib.sessions.backends.cached_db" bgneal@189: SESSION_COOKIE_AGE = 2 * 7 * 24 * 60 * 60 # 2 weeks in seconds bgneal@189: SESSION_COOKIE_DOMAIN = None bgneal@189: SESSION_COOKIE_NAME = 'sg101_sessionid' bgneal@189: SESSION_COOKIE_PATH = '/' bgneal@189: SESSION_COOKIE_SECURE = False bgneal@189: SESSION_EXPIRE_AT_BROWSER_CLOSE = False bgneal@189: SESSION_SAVE_EVERY_REQUEST = False bgneal@189: bgneal@189: ####################################################################### gremmie@1: # Tagging Specific Settings gremmie@1: ####################################################################### gremmie@1: FORCE_LOWERCASE_TAGS = True gremmie@1: MAX_TAG_LENGTH = 50 gremmie@1: gremmie@1: ####################################################################### bgneal@219: # Haystack Search Settings bgneal@219: ####################################################################### bgneal@219: HAYSTACK_SITECONF = 'gpp.search_sites' bgneal@219: HAYSTACK_SEARCH_ENGINE = 'xapian' bgneal@219: HAYSTACK_XAPIAN_PATH = os.path.join(project_path, 'xapian_index') bgneal@219: bgneal@219: bgneal@219: ####################################################################### gremmie@1: # GPP Specific Settings gremmie@1: ####################################################################### gremmie@1: GPP_LOG_LEVEL = 0 bgneal@180: GPP_SEND_EMAIL = local_settings.GPP_SEND_EMAIL # see MAILER_ENQUEUE_MAIL gremmie@1: GPP_NO_REPLY_EMAIL = 'no_reply' gremmie@1: AVATAR_DIR = 'avatars' gremmie@1: MAX_AVATAR_SIZE_BYTES = 2 * 1024 * 1024 gremmie@1: MAX_AVATAR_SIZE_PIXELS = 100 gremmie@1: AVATAR_DEFAULT_URL = MEDIA_URL + AVATAR_DIR + '/default.png' bgneal@36: bgneal@36: # Donations application settings: bgneal@66: DONATIONS_DEBUG = local_settings.DONATIONS_DEBUG bgneal@35: DONATIONS_ITEM_NAME = 'Donation for SurfGuitar101.com' bgneal@35: DONATIONS_BUSINESS = 'brian@surfguitar101.com' bgneal@62: DONATIONS_BUSINESS_DEBUG = local_settings.DONATIONS_BUSINESS_DEBUG bgneal@59: DONATIONS_GOAL = Decimal('100.00') # monthly goal bgneal@35: DONATIONS_ANON_NAME = u'Anonymous' bgneal@60: DONATIONS_ITEM_NUM = '500' # donation w/name listed bgneal@60: DONATIONS_ITEM_ANON_NUM = '501' # donation listed as anonymous bgneal@6: bgneal@180: # If MAILER_ENQUEUE_MAIL is True, all emails will be stored in the bgneal@180: # mailer application's mail queue (database table). It is then expected bgneal@180: # that a daemon or cron job will actually send the mail out. If bgneal@180: # MAILER_ENQUEUE_MAIL is False, then email will only be sent if bgneal@180: # the setting GPP_SEND_EMAIL (above) is True. In any event, emails bgneal@180: # will be logged via the Python logger if the Python logger filter bgneal@180: # DEBUG is active. bgneal@180: bgneal@180: MAILER_ENQUEUE_MAIL = True bgneal@180: bgneal@38: ####################################################################### bgneal@38: # Configure Logging bgneal@38: ####################################################################### bgneal@38: bgneal@38: logging.basicConfig( bgneal@38: filename=os.path.join(project_path, 'logs', 'gpp.log'), bgneal@38: filemode='a', bgneal@38: format='%(asctime)s %(levelname)s %(message)s', bgneal@38: level=local_settings.LOG_LEVEL) bgneal@38: bgneal@206: ####################################################################### bgneal@206: # Django Debug Toolbar bgneal@206: ####################################################################### bgneal@206: bgneal@206: if DEBUG: bgneal@206: DEBUG_TOOLBAR_CONFIG = local_settings.DEBUG_TOOLBAR_CONFIG bgneal@38: bgneal@38: ####################################################################### bgneal@6: # URL's of 3rd party Javascript and CSS files. bgneal@6: # These dictionaries are used by core/templatetags/script_tags, and bgneal@6: # should also be used by developers when creating form media classes. bgneal@6: GPP_THIRD_PARTY_JS = { bgneal@6: 'jquery': ( bgneal@184: 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js', bgneal@6: ), bgneal@6: 'jquery-jeditable': ( bgneal@6: 'js/jquery.jeditable.mini.js', bgneal@6: ), bgneal@6: 'jquery-ui': ( bgneal@246: 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js', bgneal@6: ), bgneal@6: 'markitup': ( bgneal@6: 'js/markitup/jquery.markitup.pack.js', bgneal@6: 'js/markitup/sets/markdown/set.js', bgneal@6: ), bgneal@7: 'tiny_mce': ( bgneal@7: 'js/tiny_mce/tiny_mce.js', bgneal@7: 'js/tiny_mce_init_std.js', bgneal@7: ), bgneal@6: } bgneal@6: GPP_THIRD_PARTY_CSS = { bgneal@6: 'jquery-ui': ( bgneal@246: 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/themes/redmond/jquery-ui.css', bgneal@6: ), bgneal@6: 'markitup': ( bgneal@6: 'js/markitup/skins/markitup/style.css', bgneal@6: 'js/markitup/sets/markdown/style.css', bgneal@6: ), bgneal@6: } bgneal@6: