Delete me

from datetime import datetime, timedelta
import os.path
# Django settings for pypvs project.

MYPVS = True

DEBUG = True
TEMPLATE_DEBUG = DEBUG
CACHE_USE_ANYWAY = True
RELEASE_ID = 1
IS_BSD = True
APP_ROOT = os.path.dirname(os.path.abspath(__file__))
PHOTO_URL = '//votesmart.org/canphoto/'
STAFF_PHOTO_PATH = 'images/staff' # the path under MEDIA_ROOT that staff images are stored to
ELECTION_CUTOFF = datetime.now() - timedelta(days=120)
ALLOWED_DOCUMENT_EXTENSIONS = ('doc', 'docx', 'odt', 'pdf', 'txt', 'rtf')

# User and authentication stuff
if MYPVS:
    AUTH_PROFILE_MODULE         = 'misc.UserProfile'
    LOGIN_URL                   = "/login"
    LOGIN_REDIRECT_URL          = "/user"
    LOGIN_ERROR_URL             = '/login'
    SOCIAL_AUTH_BACKEND_ERROR_URL = '/login'
    SOCIAL_AUTH_RAISE_EXCEPTIONS = False
    REGISTRATION_OPEN           = True
    FACEBOOK_APP_ID             = '380926668611330'  # AKA AppId
    FACEBOOK_API_SECRET         = '236538fd88b7e796162836b24c4a43d9'
    FACEBOOK_AUTH_EXTRA_ARGUMENTS = { 'scope': 'email,user_location', }
    FACEBOOK_EXTENDED_PERMISSIONS = [ 'email', 'user_location', ]
    TWITTER_CONSUMER_KEY        = 'RnBb9wMNHNR50LYDV5rwBA'
    TWITTER_CONSUMER_SECRET     = 'skoHna4kEqd7mGX1UI7ThZmgQYIR8BwJwR8INYW20'
    SECURITY_BRUTE_FORCE_TIMEOUT = 900 # 15 minutes
    SECURITY_LOGIN_MAX_TRIES    = 3


RECAPTCHA_PUBLIC_KEY = '6LdCx8oSAAAAANffmmgIIBzogaQEbkD1woQzh2aZ'
RECAPTCHA_PRIVATE_KEY = '6LdCx8oSAAAAAEJKLyrDL_2Lqed00BSa9Tzm0rkZ'

# iContact Credentials
ICONTACT_AUTH = {
    'api_key': 'yVyx6HjehecM2BZUDLykcGtlrjDSAuEZ',
    'username': 'votesmart',
    'password': 'xxx',
}

ICONTACT_SANDBOX_AUTH = {
    'api_key': 'fKonKk3SFU3VeKCiIFBPObMb3QT7908f',
    'username': 'votesmart-beta',
    'password': 'xxx',
}

ADMINS = (
    ('Webmaster', 'webmaster@votesmart.org'),
)

MANAGERS = ADMINS

# NOTE - The user here must have django added to their search_path in pg
# to be able to access the django-related tables.
# ALTER USER <user> SET search_path = '$user',public,django;
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': 'pvsadmin',                      # Or path to database file if using sqlite3.
        'USER': 'mike',                      # Not used with sqlite3.
        'PASSWORD': 'xxx',                  # Not used with sqlite3.
        'HOST': '209.18.106.113',                      # Set to empty string for localhost. Not used with sqlite3.
        #'HOST': 'twinkie',
        # twix doesn't have blog shit yet 'HOST': 'twix',
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
        #'PORT': '6432',
        'OPTIONS': {
            'autocommit': True
        }
    }
}
REDIS_HOST  = 'localhost'
REDIS_PORT  = 6379
REDIS_DB    = 0

REDIS_NOTIFY_EXPIRE = 604800     # 604800 = 1 week

if DEBUG and CACHE_USE_ANYWAY == False:
    CACHES = {
        'default': {
            'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
        }
    }
else:
    CACHES = {
        'default': {
            'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
            'LOCATION': '127.0.0.1:11211',
            'TIMEOUT': 60,
        }
    }
CACHE_MIDDLEWARE_SECONDS = 3600 # 1 hr
CACHE_CRP_TIMEOUT = 86400 # 24 hrs
CACHE_NIMSP_TIMEOUT = CACHE_CRP_TIMEOUT

SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'mail.votesmart.org'

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Denver'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale
USE_L10N = True

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
# THIS NEEDS TO BE SET FOR ANY FILE UPLOADS TO WORK
MEDIA_ROOT = APP_ROOT + '/static/'

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = 'http://lifter.votesmart.org:8000/static/'

STATIC_URL = '/static/'
STATICFILES_DIRS = (
    APP_ROOT + '/static',
)

# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/static/admmed/'

# Make this unique, and don't share it with anybody.
SECRET_KEY = '=g35ii+2mkwm$8zh#&5wk@$00dnuq6+9!j7$g9tb6bfne4ik$d'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
#     'django.template.loaders.eggs.Loader',
)

# Needed for debug_toolbar
INTERNAL_IPS = tuple(["192.168.255.%s" % i for i in range(255)])
INTERNAL_IPS += ('127.0.0.1',)

MIDDLEWARE_CLASSES = (
    'django.middleware.cache.UpdateCacheMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'debug_toolbar.middleware.DebugToolbarMiddleware',
    'django.middleware.cache.FetchFromCacheMiddleware',
    #'pypvs.misc.middleware.StatsMiddleware',
)

ROOT_URLCONF = 'pypvs.urls'

TEMPLATE_DIRS = (
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    '/home/mike/dev/pypvs/templates',
    '/usr/lib/python2.6/site-packages/django_debug_toolbar-0.8.3-py2.6.egg/debug_toolbar/templates',
)

TEMPLATE_CONTEXT_PROCESSORS = (
    'django.contrib.messages.context_processors.messages',
    'django.contrib.auth.context_processors.auth',
    'django.core.context_processors.request',
)
if MYPVS:
    TEMPLATE_CONTEXT_PROCESSORS += (
        'pypvs.misc.context.settings_context_processor',
        'social_auth.context_processors.social_auth_by_name_backends',
    )

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'pypvs.elections',
    'pypvs.candidate',
    'pypvs.government',
    'pypvs.keyvotes',
    'pypvs.offices',
    'pypvs.about',
    'pypvs.media',
    'pypvs.education',
    'pypvs.helpus',
    'pypvs.share',
    'pypvs.forcandidates',
    'pypvs.search',
    'pypvs.issues',
    'pypvs.education',
    'tagging',
    'django.contrib.comments',
    'django.contrib.markup',
    'pypvs.blog',
    'pypvs.inlines',
    'pypvs.misc',
    # Uncomment the next line to enable the admin:
    'django.contrib.admin',
)
if MYPVS:
    INSTALLED_APPS += (
        'social_auth',
        'pypvs.survey',
        'pypvs.tracking',
    )

    AUTHENTICATION_BACKENDS = (
        'social_auth.backends.twitter.TwitterBackend',
        'social_auth.backends.facebook.FacebookBackend',
        #'social_auth.backends.google.GoogleOAuthBackend',
        #'social_auth.backends.google.GoogleOAuth2Backend',
        #'social_auth.backends.google.GoogleBackend',
        #'social_auth.backends.yahoo.YahooBackend',
        #'social_auth.backends.browserid.BrowserIDBackend',
        #'social_auth.backends.contrib.linkedin.LinkedinBackend',
        #'social_auth.backends.contrib.livejournal.LiveJournalBackend',
        #'social_auth.backends.contrib.orkut.OrkutBackend',
        #'social_auth.backends.contrib.foursquare.FoursquareBackend',
        #'social_auth.backends.contrib.github.GithubBackend',
        #'social_auth.backends.contrib.dropbox.DropboxBackend',
        #'social_auth.backends.contrib.flickr.FlickrBackend',
        #'social_auth.backends.contrib.instagram.InstagramBackend',
        #'social_auth.backends.contrib.vkontakte.VkontakteBackend',
        'social_auth.backends.OpenIDBackend',
        #'social_auth.backends.contrib.bitbucket.BitbucketBackend',
        'django.contrib.auth.backends.ModelBackend',
    )

"""LOGGING = {
    'version': 1,
    'disable_existing_loggers': True,
    'formatters': {
        'simple': {
            'format': '%(levelname)s %(message)s'
        },
    },
    'handlers': {
        'file': {
            'class': 'logging.handlers.RotatingFileHandler',
            'formatter': 'simple',
            'filename': '/var/log/myapp.log',
            'maxBytes': '4096',
            'backupCount': '5'
        },
        'console': {
            'level':'DEBUG',
            'class':'logging.StreamHandler',
            'formatter': 'simple'
        }
    },
    'loggers': {
        'myapp.lib': {
            'handlers': ['file', 'console',],
            'level': 'INFO',
        },
    }
}"
""
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki