"""
Django settings for tglserver project.

Generated by 'django-admin startproject' using Django 1.11.1.

For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os,sys,platform
osgis, osrel, osver = platform.system(), platform.release(), platform.version()

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SITE_PATH = os.path.abspath(os.path.dirname(__file__))
PROJ_PATH = os.path.normpath(os.path.join(SITE_PATH, '..', '..'))
APPS_PATH = os.path.join(PROJ_PATH, 'tgl_apps')
if APPS_PATH not in sys.path:
    sys.path.insert(0, APPS_PATH)



print ('DroneKarta system runs at: %s' % platform.node())

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
# BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '6+vhp&sl*tveukt-lixccx3e5=r55&wyx_x!oy8txb*oy*3r)g'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = [u'dronekarta.pythonanywhere.com', u'localhost:8000', u'127.0.0.1', u'localhost']


# Application definition

INSTALLED_APPS = [
    'grappelli',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    'rest_framework',
    'rest_framework_xml',

    'djng',

    'tlsites',

    'debug_toolbar',
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',

    'debug_toolbar.middleware.DebugToolbarMiddleware',
]

ROOT_URLCONF = 'tglserver.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ['templates', '/home/dronekarta/tgdj_apps/tglserver/templates/'],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'tglserver.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}


# Password validation
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


INTERNAL_IPS = ['127.0.0.1']

# Internationalization
# https://docs.djangoproject.com/en/1.11/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/
STATIC_URL = '/static/'

# default static files settings for PythonAnywhere.
# see https://help.pythonanywhere.com/pages/DjangoStaticFiles for more info
platf = platform.node()
if platform.node() == 'todor-ThinkPad-X230':
    MEDIA_ROOT = u'/dkt/tgdj_apps/media'
    MEDIA_ROOT = '/media/'
#    STATIC_ROOT = u'/dkt/tgdj_apps/static'
    STATIC_URL = '/static/'
    STATICFILES_DIRS = (
        os.path.join(PROJ_PATH, 'static'),
    )
else:
    MEDIA_ROOT = u'/home/dronekarta/tgdj_apps/media'
    MEDIA_URL = '/media/'
#    STATIC_ROOT = u'/home/dronekarta/tgdj_apps/static'
    STATIC_URL = '/static/'
    STATICFILES_DIRS = (
        os.path.join(PROJ_PATH, 'static'),
    )

@@ -3672,16 +3672,32 @@
 7.0.0.1'
+, '95.43.211.25'
 %5D%0A%0A# Int

add to IPS