bgneal@499: # Base Django settings for the gpp project. bgneal@499: bgneal@499: import os bgneal@499: from decimal import Decimal bgneal@499: bgneal@499: import django.utils.simplejson as json bgneal@499: from django.contrib.messages import constants as message_constants bgneal@512: import djcelery bgneal@515: from celery.schedules import crontab bgneal@512: bgneal@499: bgneal@499: PROJECT_PATH = os.path.abspath(os.path.join(os.path.split(__file__)[0], '..')) bgneal@499: bgneal@499: DEBUG = True bgneal@499: TEMPLATE_DEBUG = DEBUG bgneal@499: bgneal@499: ADMINS = ( bgneal@499: ('Brian Neal', 'admin@surfguitar101.com'), bgneal@499: ) bgneal@499: bgneal@499: MANAGERS = ADMINS bgneal@499: bgneal@499: AUTH_PROFILE_MODULE = 'bio.userprofile' bgneal@499: bgneal@499: INTERNAL_IPS = ['127.0.0.1'] bgneal@499: bgneal@499: # Local time zone for this installation. Choices can be found here: bgneal@499: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name bgneal@499: # although not all choices may be available on all operating systems. bgneal@499: # If running in a Windows environment this must be set to the same as your bgneal@499: # system time zone. bgneal@499: TIME_ZONE = 'America/Chicago' bgneal@499: bgneal@499: # Language code for this installation. All choices can be found here: bgneal@499: # http://www.i18nguy.com/unicode/language-identifiers.html bgneal@499: LANGUAGE_CODE = 'en-us' bgneal@499: bgneal@499: SITE_ID = 1 bgneal@499: bgneal@499: # If you set this to False, Django will make some optimizations so as not bgneal@499: # to load the internationalization machinery. bgneal@499: USE_I18N = False bgneal@499: bgneal@499: # Absolute path to the directory that holds media. bgneal@499: # Example: "/home/media/media.lawrence.com/" bgneal@499: MEDIA_ROOT = os.path.abspath(os.path.join(PROJECT_PATH, '..', 'media')) bgneal@499: bgneal@499: # URL that handles the media served from MEDIA_ROOT. Make sure to use a bgneal@499: # trailing slash if there is a path component (optional in other cases). bgneal@499: # Examples: "http://media.lawrence.com", "http://example.com/media/" bgneal@499: MEDIA_URL = '/media/' bgneal@499: bgneal@499: # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a bgneal@499: # trailing slash. bgneal@499: # Examples: "http://foo.com/media/", "/media/". bgneal@499: ADMIN_MEDIA_PREFIX = '/static/admin/' bgneal@499: bgneal@499: # Staticfiles settings: bgneal@499: STATICFILES_DIRS = [ bgneal@499: os.path.abspath(os.path.join(PROJECT_PATH, '..', 'static')), bgneal@499: ] bgneal@499: STATIC_ROOT = '/tmp/test_static_root' bgneal@499: STATIC_URL = '/static/' bgneal@499: bgneal@499: # Make this unique, and don't share it with anybody. bgneal@499: SECRETS = json.load(open(os.path.join(PROJECT_PATH, 'settings', 'secrets.json'))) bgneal@499: SECRET_KEY = SECRETS['SECRET_KEY'] bgneal@499: bgneal@499: # List of Loader classes that know how to import templates from various sources. bgneal@499: bgneal@499: TEMPLATE_LOADERS = ( bgneal@499: 'django.template.loaders.filesystem.Loader', bgneal@499: 'django.template.loaders.app_directories.Loader', bgneal@499: ) bgneal@499: bgneal@499: MIDDLEWARE_CLASSES = [ bgneal@499: 'django.middleware.common.CommonMiddleware', bgneal@499: 'django.middleware.csrf.CsrfViewMiddleware', bgneal@499: 'django.contrib.sessions.middleware.SessionMiddleware', bgneal@499: 'django.contrib.messages.middleware.MessageMiddleware', bgneal@499: 'django.contrib.auth.middleware.AuthenticationMiddleware', bgneal@499: 'gpp.core.middleware.InactiveUserMiddleware', bgneal@499: 'gpp.core.middleware.WhosOnline', bgneal@499: 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', bgneal@499: ] bgneal@499: bgneal@499: ROOT_URLCONF = 'gpp.urls' bgneal@499: bgneal@499: TEMPLATE_DIRS = ( bgneal@499: # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". bgneal@499: # Always use forward slashes, even on Windows. bgneal@499: # Don't forget to use absolute paths, not relative paths. bgneal@499: os.path.join(PROJECT_PATH, 'templates'), bgneal@499: ) bgneal@499: bgneal@499: TEMPLATE_CONTEXT_PROCESSORS = ( bgneal@499: "django.contrib.auth.context_processors.auth", bgneal@499: "django.core.context_processors.debug", bgneal@499: "django.core.context_processors.request", bgneal@499: "django.core.context_processors.media", bgneal@499: "django.core.context_processors.static", bgneal@499: "django.contrib.messages.context_processors.messages", bgneal@499: ) bgneal@499: bgneal@499: INSTALLED_APPS = [ bgneal@499: 'django.contrib.admin', bgneal@499: 'django.contrib.admindocs', bgneal@499: 'django.contrib.auth', bgneal@499: 'django.contrib.contenttypes', bgneal@499: 'django.contrib.flatpages', bgneal@499: 'django.contrib.humanize', bgneal@499: 'django.contrib.markup', bgneal@499: 'django.contrib.messages', bgneal@499: 'django.contrib.sessions', bgneal@499: 'django.contrib.sites', bgneal@499: 'django.contrib.staticfiles', bgneal@512: 'djcelery', bgneal@499: 'elsewhere', bgneal@499: 'haystack', bgneal@499: 'queued_search', bgneal@512: 'tagging', bgneal@499: 'accounts', bgneal@499: 'antispam', bgneal@499: 'bio', bgneal@499: 'bulletins', bgneal@499: 'comments', bgneal@499: 'contact', bgneal@499: 'core', bgneal@525: 'custom_search', bgneal@499: 'donations', bgneal@499: 'downloads', bgneal@499: 'forums', bgneal@499: 'gcalendar', bgneal@499: 'irc', bgneal@499: 'legacy', bgneal@499: 'mailer', bgneal@499: 'membermap', bgneal@499: 'messages', bgneal@499: 'news', bgneal@499: 'oembed', bgneal@499: 'podcast', bgneal@499: 'polls', bgneal@499: 'potd', bgneal@499: 'shoutbox', bgneal@499: 'smiley', bgneal@499: 'weblinks', bgneal@499: 'ygroup', bgneal@499: ] bgneal@499: bgneal@499: LOGIN_URL = '/accounts/login/' bgneal@499: LOGIN_REDIRECT_URL = '/profile/me/' bgneal@499: LOGOUT_URL = '/accounts/logout/' bgneal@499: bgneal@499: FILE_UPLOAD_PERMISSIONS = 0644 bgneal@499: DEFAULT_FROM_EMAIL = ADMINS[0][1] bgneal@499: bgneal@499: ####################################################################### bgneal@499: # Messages bgneal@499: ####################################################################### bgneal@499: MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage' bgneal@499: MESSAGE_TAGS = { bgneal@499: message_constants.DEBUG: 'notice', bgneal@499: message_constants.INFO: 'info', bgneal@499: message_constants.SUCCESS: 'success', bgneal@499: message_constants.WARNING: 'alert', bgneal@499: message_constants.ERROR: 'error', bgneal@499: } bgneal@499: bgneal@499: ####################################################################### bgneal@499: # Email bgneal@499: ####################################################################### bgneal@499: EMAIL_HOST = 'localhost' bgneal@499: EMAIL_PORT = 1025 bgneal@512: EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' bgneal@499: bgneal@499: ####################################################################### bgneal@499: # Sessions bgneal@499: ####################################################################### bgneal@499: SESSION_ENGINE = "django.contrib.sessions.backends.cached_db" bgneal@499: SESSION_COOKIE_AGE = 2 * 7 * 24 * 60 * 60 # 2 weeks in seconds bgneal@499: SESSION_COOKIE_DOMAIN = None bgneal@499: SESSION_COOKIE_NAME = 'sg101_sessionid' bgneal@499: SESSION_COOKIE_PATH = '/' bgneal@499: SESSION_COOKIE_SECURE = False bgneal@499: SESSION_EXPIRE_AT_BROWSER_CLOSE = False bgneal@499: SESSION_SAVE_EVERY_REQUEST = False bgneal@499: bgneal@499: ####################################################################### bgneal@499: # Tagging Specific Settings bgneal@499: ####################################################################### bgneal@499: FORCE_LOWERCASE_TAGS = True bgneal@499: MAX_TAG_LENGTH = 50 bgneal@499: bgneal@499: ####################################################################### bgneal@499: # Haystack Search Settings bgneal@499: ####################################################################### bgneal@499: HAYSTACK_SITECONF = 'gpp.search_sites' bgneal@499: HAYSTACK_SEARCH_ENGINE = 'xapian' bgneal@499: HAYSTACK_XAPIAN_PATH = os.path.join(PROJECT_PATH, 'xapian_index') bgneal@499: bgneal@499: bgneal@499: ####################################################################### bgneal@522: # Redis integration & settings bgneal@522: ####################################################################### bgneal@522: REDIS_HOST = 'localhost' bgneal@522: REDIS_PORT = 6379 bgneal@522: REDIS_DB = 0 bgneal@522: bgneal@522: ####################################################################### bgneal@512: # Celery integration & settings bgneal@512: ####################################################################### bgneal@512: BROKER_URL = 'redis://localhost:6379/1' bgneal@512: BROKER_POOL_LIMIT = 10 bgneal@512: bgneal@514: CELERY_IGNORE_RESULT = True bgneal@512: CELERY_RESULT_BACKEND = 'redis' bgneal@512: CELERY_REDIS_HOST = 'localhost' bgneal@512: CELERY_REDIS_PORT = 6379 bgneal@512: CELERY_REDIS_DB = 1 bgneal@512: bgneal@512: CELERY_DISABLE_RATE_LIMITS = True bgneal@512: CELERY_SEND_TASK_ERROR_EMAILS = True bgneal@512: bgneal@512: djcelery.setup_loader() bgneal@512: bgneal@515: CELERYBEAT_SCHEDULE = { bgneal@515: "potd": { bgneal@515: "task": "potd.tasks.pick_potd", bgneal@515: "schedule": crontab(minute=0, hour=0), bgneal@516: }, bgneal@516: "cleanup": { bgneal@516: "task": "core.tasks.cleanup", bgneal@516: "schedule": crontab(minute=0, hour=1), bgneal@516: }, bgneal@519: "purge_messages": { bgneal@518: "task": "messages.tasks.purge_messages", bgneal@518: "schedule": crontab(minute=30, hour=1, day_of_week='sunday'), bgneal@519: }, bgneal@519: "max_users": { bgneal@519: "task": "core.tasks.max_users", bgneal@519: "schedule": crontab(minute='*/15'), bgneal@519: }, bgneal@525: "search_queue": { bgneal@525: "task": "custom_search.tasks.process_search_queue_task", bgneal@525: "schedule": crontab(minute='*/20'), bgneal@525: }, bgneal@515: } bgneal@515: bgneal@512: ####################################################################### bgneal@499: # GPP Specific Settings bgneal@499: ####################################################################### bgneal@499: GPP_NO_REPLY_EMAIL = 'no_reply' bgneal@499: AVATAR_DIR = 'avatars' bgneal@499: MAX_AVATAR_SIZE_BYTES = 2 * 1024 * 1024 bgneal@499: MAX_AVATAR_SIZE_PIXELS = 100 bgneal@499: AVATAR_DEFAULT_URL = MEDIA_URL + AVATAR_DIR + '/default.png' bgneal@499: bgneal@499: # Donations application settings: bgneal@499: DONATIONS_DEBUG = False bgneal@499: DONATIONS_ITEM_NAME = 'Donation for SurfGuitar101.com' bgneal@499: DONATIONS_BUSINESS = 'brian@surfguitar101.com' bgneal@499: DONATIONS_BUSINESS_DEBUG = 'bgneal_1246137628_biz@gmail.com' bgneal@499: DONATIONS_GOAL = Decimal('100.00') # monthly goal bgneal@499: DONATIONS_ANON_NAME = u'Anonymous' bgneal@499: DONATIONS_ITEM_NUM = '500' # donation w/name listed bgneal@499: DONATIONS_ITEM_ANON_NUM = '501' # donation listed as anonymous bgneal@499: bgneal@499: # Oembed settings bgneal@499: OEMBED_MAXWIDTH = 480 bgneal@499: OEMBED_MAXHEIGHT = 295 bgneal@499: bgneal@499: # GCalendar settings bgneal@499: GCAL_CALENDAR_ID = 'i81lu3fkh57sgqqenogefd9v78@group.calendar.google.com' bgneal@499: bgneal@499: # Google OAuth settings bgneal@499: GOOGLE_OAUTH_CONSUMER_KEY = 'surfguitar101.com' bgneal@514: GOOGLE_OAUTH_PRIVATE_KEY_PATH = SECRETS['GOOGLE_KEY_PATH'] bgneal@499: bgneal@499: ####################################################################### bgneal@499: # Asynchronous settings (queues, queued_search, redis, celery, etc) bgneal@499: ####################################################################### bgneal@499: QUEUE_BACKEND = 'redisd' bgneal@499: QUEUE_REDIS_CONNECTION = 'localhost:6379' bgneal@499: QUEUE_REDIS_DB = 0 bgneal@499: bgneal@499: ####################################################################### bgneal@499: # Open Graph Protocol related settings bgneal@499: ####################################################################### bgneal@499: OGP_DEFAULT_IMAGE = 'http://surfguitar101.com/media/podcast/podcast_logo.jpg' bgneal@499: OGP_FB_ID = '100001558124013' bgneal@499: bgneal@499: ####################################################################### bgneal@499: # URL's of 3rd party Javascript and CSS files. bgneal@499: # These dictionaries are used by core/templatetags/script_tags, and bgneal@499: # should also be used by developers when creating form media classes. bgneal@499: GPP_THIRD_PARTY_JS = { bgneal@499: 'jquery': [ bgneal@499: 'http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js', bgneal@499: ], bgneal@499: 'jquery-jeditable': [ bgneal@499: 'js/jquery.jeditable.mini.js', bgneal@499: ], bgneal@499: 'jquery-ui': [ bgneal@499: 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js', bgneal@499: ], bgneal@499: 'markitup': [ bgneal@499: 'js/markitup/jquery.markitup.pack.js', bgneal@499: 'js/markitup/sets/markdown/set.js', bgneal@499: ], bgneal@499: 'tiny_mce': [ bgneal@499: 'js/tiny_mce/tiny_mce.js', bgneal@499: 'js/tiny_mce_init_std.js', bgneal@499: ], bgneal@499: } bgneal@499: bgneal@499: GPP_THIRD_PARTY_CSS = { bgneal@499: 'jquery-ui': [ bgneal@499: 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/themes/redmond/jquery-ui.css', bgneal@499: ], bgneal@499: 'markitup': [ bgneal@499: 'js/markitup/skins/markitup/style.css', bgneal@499: 'js/markitup/sets/markdown/style.css', bgneal@499: ], bgneal@499: } bgneal@499: