import os
from pathlib import Path

BASE_DIR = Path(__file__).resolve().parent.parent

SECRET_KEY = os.environ.get('SECRET_KEY', 'pyswiss-dev-only-key-replace-in-production')
DEBUG = os.environ.get('DEBUG', 'true').lower() != 'false'
ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '*').split(',')

INSTALLED_APPS = [
    'corsheaders',
    'django.contrib.contenttypes',
    'django.contrib.auth',
    'apps.charts',
]

MIDDLEWARE = [
    'corsheaders.middleware.CorsMiddleware',
    'django.middleware.common.CommonMiddleware',
]

CORS_ALLOWED_ORIGIN_REGEXES = [
    r'^https://.*\.earthmanrpg\.me$',
    r'^http://localhost(:\d+)?$',
]

ROOT_URLCONF = 'core.urls'

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / 'db.sqlite3',
    }
}

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

STATIC_URL = '/static/'
MEDIA_URL = '/media/'

USE_TZ = True
TIME_ZONE = 'UTC'

# Swiss Ephemeris data files.
# Override via SWISSEPH_PATH env var on staging/production.
SWISSEPH_PATH = os.environ.get(
    'SWISSEPH_PATH',
    r'D:\OneDrive\Desktop\potentium\implicateOrder\libraries\swisseph-master\ephe',
)
