import os
from pathlib import Path
import firebase_admin
from firebase_admin import credentials

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

cred = credentials.Certificate(
    'ecommerce-dd540-firebase-adminsdk-qygvh-ced3939896.json')
firebase_admin.initialize_app(
    cred, {'databaseURL': 'https://ecommerce-dd540-default-rtdb.asia-southeast1.firebasedatabase.app'})

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

CATEGORY_THUMBNAIL_SIZE = (100, 100)
COUPON_THUMBNAIL_SIZE = (300, 200)
PRODUCT_THUMBNAIL_SIZE = (200, 200)

EMAIL_TASKS_REQUIRED = False

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-c%myru*r-zrzp&r4ybvje1-en*xra#getu8jzelx(#*=po^ft3'

FRONTEND_URL = 'http://localhost:3000'

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

#ALLOWED_HOSTS = ['192.168.43.48']
ALLOWED_HOSTS = ['*']

EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'tushar.testmail007@gmail.com'
EMAIL_HOST_PASSWORD = 'zzkhqauzqbqucgmg'
EMAIL_PORT = 587
EMAIL_USE_TLS = True

# Application definition

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

    'django.contrib.sites',
    'django_filters',
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    'rest_auth.registration',
    'rest_framework',
    'rest_framework.authtoken',
    'rest_auth',
    'corsheaders',

    'dj_rest_auth',

    'allauth.socialaccount.providers.google',
    'allauth.socialaccount.providers.facebook',

    'graphene_django',

    'graphqlapi',
    'restapi',
    'superadmin',
]

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',
    'corsheaders.middleware.CorsMiddleware',
]

REST_FRAMEWORK = {
    'DEFAULT_PERMISSION_CLASSES': ['rest_framework.authtoken'],
    'DEFAULT_AUTHENTICATION_CLASSES': ['rest_framework.authentication.TokenAuthentication', ],
}

ACCOUNT_EMAIL_VERIFICATION = 'none'
ACCOUNT_AUTHENTICATION_METHOD = 'username'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_USERNAME_REQUIRED = True

CORS_ORIGIN_ALLOW_ALL = True

# CORS_ORIGIN_WHITELIST = (
#    config('FRONTEND_URL'),
# )

ROOT_URLCONF = 'EcommerceAPI.urls'

SITE_ID = 2

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, '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 = 'EcommerceAPI.wsgi.application'


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

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'ecomm',
        'USER': 'batrasagar',
        'PASSWORD': '1707sp@@',
        'HOST': 'localhost'
    }
}

# Password validation
# https://docs.djangoproject.com/en/3.2/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',
    },
]


# Internationalization
# https://docs.djangoproject.com/en/3.2/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/3.2/howto/static-files/

STATIC_URL = '/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

fbd7ef4396cd25ae9f145f764d290183d92c490b
<mask token>

<mask token>
firebase_admin.initialize_app(cred, {'databaseURL':
    'https://ecommerce-dd540-default-rtdb.asia-southeast1.firebasedatabase.app'
    })
<mask token>

<mask token>
BASE_DIR = Path(__file__).resolve().parent.parent
cred = credentials.Certificate(
    'ecommerce-dd540-firebase-adminsdk-qygvh-ced3939896.json')
firebase_admin.initialize_app(cred, {'databaseURL':
    'https://ecommerce-dd540-default-rtdb.asia-southeast1.firebasedatabase.app'
    })
CATEGORY_THUMBNAIL_SIZE = 100, 100
COUPON_THUMBNAIL_SIZE = 300, 200
PRODUCT_THUMBNAIL_SIZE = 200, 200
EMAIL_TASKS_REQUIRED = False
SECRET_KEY = (
    'django-insecure-c%myru*r-zrzp&r4ybvje1-en*xra#getu8jzelx(#*=po^ft3')
FRONTEND_URL = 'http://localhost:3000'
DEBUG = True
ALLOWED_HOSTS = ['*']
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'tushar.testmail007@gmail.com'
EMAIL_HOST_PASSWORD = 'zzkhqauzqbqucgmg'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
INSTALLED_APPS = ['django.contrib.admin', 'django.contrib.auth',
    'django.contrib.contenttypes', 'django.contrib.sessions',
    'django.contrib.messages', 'django.contrib.staticfiles',
    'django.contrib.sites', 'django_filters', 'allauth', 'allauth.account',
    'allauth.socialaccount', 'rest_auth.registration', 'rest_framework',
    'rest_framework.authtoken', 'rest_auth', 'corsheaders', 'dj_rest_auth',
    'allauth.socialaccount.providers.google',
    'allauth.socialaccount.providers.facebook', 'graphene_django',
    'graphqlapi', 'restapi', 'superadmin']
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',
    'corsheaders.middleware.CorsMiddleware']
REST_FRAMEWORK = {'DEFAULT_PERMISSION_CLASSES': ['rest_framework.authtoken'
    ], 'DEFAULT_AUTHENTICATION_CLASSES': [
    'rest_framework.authentication.TokenAuthentication']}
ACCOUNT_EMAIL_VERIFICATION = 'none'
ACCOUNT_AUTHENTICATION_METHOD = 'username'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_USERNAME_REQUIRED = True
CORS_ORIGIN_ALLOW_ALL = True
ROOT_URLCONF = 'EcommerceAPI.urls'
SITE_ID = 2
TEMPLATES = [{'BACKEND': 'django.template.backends.django.DjangoTemplates',
    'DIRS': [os.path.join(BASE_DIR, '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 = 'EcommerceAPI.wsgi.application'
DATABASES = {'default': {'ENGINE': 'django.db.backends.postgresql', 'NAME':
    'ecomm', 'USER': 'batrasagar', 'PASSWORD': '1707sp@@', 'HOST': 'localhost'}
    }
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'}
    ]
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

import os
from pathlib import Path
import firebase_admin
from firebase_admin import credentials
BASE_DIR = Path(__file__).resolve().parent.parent
cred = credentials.Certificate(
    'ecommerce-dd540-firebase-adminsdk-qygvh-ced3939896.json')
firebase_admin.initialize_app(cred, {'databaseURL':
    'https://ecommerce-dd540-default-rtdb.asia-southeast1.firebasedatabase.app'
    })
CATEGORY_THUMBNAIL_SIZE = 100, 100
COUPON_THUMBNAIL_SIZE = 300, 200
PRODUCT_THUMBNAIL_SIZE = 200, 200
EMAIL_TASKS_REQUIRED = False
SECRET_KEY = (
    'django-insecure-c%myru*r-zrzp&r4ybvje1-en*xra#getu8jzelx(#*=po^ft3')
FRONTEND_URL = 'http://localhost:3000'
DEBUG = True
ALLOWED_HOSTS = ['*']
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'tushar.testmail007@gmail.com'
EMAIL_HOST_PASSWORD = 'zzkhqauzqbqucgmg'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
INSTALLED_APPS = ['django.contrib.admin', 'django.contrib.auth',
    'django.contrib.contenttypes', 'django.contrib.sessions',
    'django.contrib.messages', 'django.contrib.staticfiles',
    'django.contrib.sites', 'django_filters', 'allauth', 'allauth.account',
    'allauth.socialaccount', 'rest_auth.registration', 'rest_framework',
    'rest_framework.authtoken', 'rest_auth', 'corsheaders', 'dj_rest_auth',
    'allauth.socialaccount.providers.google',
    'allauth.socialaccount.providers.facebook', 'graphene_django',
    'graphqlapi', 'restapi', 'superadmin']
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',
    'corsheaders.middleware.CorsMiddleware']
REST_FRAMEWORK = {'DEFAULT_PERMISSION_CLASSES': ['rest_framework.authtoken'
    ], 'DEFAULT_AUTHENTICATION_CLASSES': [
    'rest_framework.authentication.TokenAuthentication']}
ACCOUNT_EMAIL_VERIFICATION = 'none'
ACCOUNT_AUTHENTICATION_METHOD = 'username'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_USERNAME_REQUIRED = True
CORS_ORIGIN_ALLOW_ALL = True
ROOT_URLCONF = 'EcommerceAPI.urls'
SITE_ID = 2
TEMPLATES = [{'BACKEND': 'django.template.backends.django.DjangoTemplates',
    'DIRS': [os.path.join(BASE_DIR, '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 = 'EcommerceAPI.wsgi.application'
DATABASES = {'default': {'ENGINE': 'django.db.backends.postgresql', 'NAME':
    'ecomm', 'USER': 'batrasagar', 'PASSWORD': '1707sp@@', 'HOST': 'localhost'}
    }
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'}
    ]
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

import os
from pathlib import Path
import firebase_admin
from firebase_admin import credentials

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

cred = credentials.Certificate(
    'ecommerce-dd540-firebase-adminsdk-qygvh-ced3939896.json')
firebase_admin.initialize_app(
    cred, {'databaseURL': 'https://ecommerce-dd540-default-rtdb.asia-southeast1.firebasedatabase.app'})

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

CATEGORY_THUMBNAIL_SIZE = (100, 100)
COUPON_THUMBNAIL_SIZE = (300, 200)
PRODUCT_THUMBNAIL_SIZE = (200, 200)

EMAIL_TASKS_REQUIRED = False

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-c%myru*r-zrzp&r4ybvje1-en*xra#getu8jzelx(#*=po^ft3'

FRONTEND_URL = 'http://localhost:3000'

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

#ALLOWED_HOSTS = ['192.168.43.48']
ALLOWED_HOSTS = ['*']

EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'tushar.testmail007@gmail.com'
EMAIL_HOST_PASSWORD = 'zzkhqauzqbqucgmg'
EMAIL_PORT = 587
EMAIL_USE_TLS = True

# Application definition

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

    'django.contrib.sites',
    'django_filters',
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    'rest_auth.registration',
    'rest_framework',
    'rest_framework.authtoken',
    'rest_auth',
    'corsheaders',

    'dj_rest_auth',

    'allauth.socialaccount.providers.google',
    'allauth.socialaccount.providers.facebook',

    'graphene_django',

    'graphqlapi',
    'restapi',
    'superadmin',
]

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',
    'corsheaders.middleware.CorsMiddleware',
]

REST_FRAMEWORK = {
    'DEFAULT_PERMISSION_CLASSES': ['rest_framework.authtoken'],
    'DEFAULT_AUTHENTICATION_CLASSES': ['rest_framework.authentication.TokenAuthentication', ],
}

ACCOUNT_EMAIL_VERIFICATION = 'none'
ACCOUNT_AUTHENTICATION_METHOD = 'username'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_USERNAME_REQUIRED = True

CORS_ORIGIN_ALLOW_ALL = True

# CORS_ORIGIN_WHITELIST = (
#    config('FRONTEND_URL'),
# )

ROOT_URLCONF = 'EcommerceAPI.urls'

SITE_ID = 2

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, '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 = 'EcommerceAPI.wsgi.application'


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

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'ecomm',
        'USER': 'batrasagar',
        'PASSWORD': '1707sp@@',
        'HOST': 'localhost'
    }
}

# Password validation
# https://docs.djangoproject.com/en/3.2/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',
    },
]


# Internationalization
# https://docs.djangoproject.com/en/3.2/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/3.2/howto/static-files/

STATIC_URL = '/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
