from common import *

DEBUG = False
# Start up logging to the filesystem

CONVERT_DEBUG = True

FILE_HANDLER = logging.FileHandler("/var/log/django/pbp_com.log", "w")
logging.getLogger("").addHandler(FILE_HANDLER)
logging.getLogger("keyedcache").setLevel(logging.DEBUG)
logging.info("penobscotbaypress.com Started")

CACHE_MIDDLEWARE_SECONDS = 10
CACHES = {
    "default": {
        "BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
        "LOCATION": "127.0.0.1:11211",
    }
}

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.postgresql_psycopg2",
        "NAME": "pbp",
        "USER": "pbp",
        "PASSWORD": "P3Prnwb",
        "HOST": "localhost",
        "PORT": "",
    }
}

MEDIA_ROOT = os.path.join(PROJECT_ROOT, "media/")
MEDIA_URL = "https://penobscotbaypress.com/media/"
# MEDIA_URL = '/media/'
ADMIN_MEDIA_PREFIX = MEDIA_URL + "admin/"
TEMPLATE_DIRS = ("/var/lib/django/pbp_com/templates",)

INTERNAL_IPS = (
    "24.93.128.34",
    "70.16.110.194",
)


def show_toolbar_when_logged_in(request):
    if request.user.is_staff:
        return True
    else:
        return False


DEBUG_TOOLBAR_CONFIG = {
    "SHOW_TOOLBAR_CALLBACK": show_toolbar_when_logged_in,
    "INTERCEPT_REDIRECTS": False,
}

# API key is for penobscotbaypress.com
GOOGLE_API_KEY = "ABQIAAAATux_aKmAEX7DnojAr8SqlRTyl9CS5q3L9FIn7JSvfaKvyESzUhR20N-9Pqstiw45F-wXH6msAoVaKw"

##### For Email ########
ACCOUNT_ACTIVATION_DAYS = 15
# EMAIL_HOST="smtp.3ip.net"
# EMAIL_HOST_USER="cpowell@penobscotbaypress.com"
# EMAIL_HOST_PASSWORD="cpow07"
# DEFAULT_FROM_EMAIL="cpowell@penobscotbaypress.com"
# EMAIL_USE_TLS = True
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST = "secure.emailsrvr.com"
EMAIL_HOST_USER = "orders@pbp.me"
EMAIL_HOST_PASSWORD = "P3Pp@ss"
DEFAULT_FROM_EMAIL = "orders@pbp.me"
EMAIL_USE_TLS = True
