208 lines
5.7 KiB
Python
208 lines
5.7 KiB
Python
|
|
from pathlib import Path
|
|
import os
|
|
import pytz
|
|
#print time zones
|
|
# for x in pytz.all_timezones_set:
|
|
# print(x)
|
|
|
|
|
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
|
|
|
|
# Quick-start development settings - unsuitable for production
|
|
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/
|
|
|
|
# SECURITY WARNING: keep the secret key used in production secret!
|
|
SECRET_KEY = 'django-insecure-5*mm&uf5zq@t6nrs_5z8-_qtyapm^3&yz^wqqkc_a!v(!ulj-^'
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
DEBUG = False
|
|
|
|
ALLOWED_HOSTS = ['*']
|
|
|
|
# Application definition
|
|
|
|
INSTALLED_APPS = [
|
|
'django.contrib.admin',
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
|
|
'rest_framework',
|
|
'rest_framework.authtoken',
|
|
|
|
'allauth',
|
|
'allauth.account',
|
|
'allauth.socialaccount',
|
|
'widget_tweaks',
|
|
'Admin',
|
|
'Clientes',
|
|
]
|
|
REST_FRAMEWORK = {
|
|
'DEFAULT_AUTHENTICATION_CLASSES': [
|
|
'rest_framework.authentication.TokenAuthentication',
|
|
],
|
|
}
|
|
SITE_ID = 1
|
|
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',
|
|
]
|
|
|
|
ROOT_URLCONF = 'Admin.urls'
|
|
|
|
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',
|
|
# `allauth` needs this from django
|
|
'django.template.context_processors.request',
|
|
'Clientes.saldo_context_proc.get_saldo',
|
|
],
|
|
},
|
|
},
|
|
]
|
|
AUTHENTICATION_BACKENDS = [
|
|
|
|
# Needed to login by username in Django admin, regardless of `allauth`
|
|
'django.contrib.auth.backends.ModelBackend',
|
|
|
|
# `allauth` specific authentication methods, such as login by e-mail
|
|
'allauth.account.auth_backends.AuthenticationBackend',
|
|
|
|
]
|
|
|
|
WSGI_APPLICATION = 'Admin.wsgi.application'
|
|
ACCOUNT_FORMS = {
|
|
'login': 'allauth.account.forms.LoginForm',
|
|
'signup': 'allauth.account.forms.SignupForm',
|
|
'add_email': 'allauth.account.forms.AddEmailForm',
|
|
'change_password': 'allauth.account.forms.ChangePasswordForm',
|
|
'set_password': 'allauth.account.forms.SetPasswordForm',
|
|
'reset_password': 'allauth.account.forms.ResetPasswordForm',
|
|
'reset_password_from_key': 'allauth.account.forms.ResetPasswordKeyForm',
|
|
'disconnect': 'allauth.socialaccount.forms.DisconnectForm',
|
|
}
|
|
LOGIN_REDIRECT_URL = '/'
|
|
ACCOUNT_LOGOUT_REDIRECT_URL = '/accounts/login/'
|
|
ACCOUNT_SIGNUP_REDIRECT_URL =LOGIN_REDIRECT_URL
|
|
ACCOUNT_LOGOUT_ON_PASSWORD_CHANGE = True
|
|
|
|
EMAIL_TIMEOUT = 10
|
|
#EMAIL_USE_TLS = True
|
|
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
|
EMAIL_HOST = 'secure.emailsrvr.com'
|
|
EMAIL_PORT = 465
|
|
EMAIL_HOST_USER = 'noreply@aduanasoft.com.mx'
|
|
EMAIL_HOST_PASSWORD = 'N036p7y!'
|
|
EMAIL_SUBJECT_PREFIX = 'AS Timbres'
|
|
EMAIL_USE_SSL=True
|
|
|
|
|
|
# Database
|
|
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases
|
|
|
|
|
|
|
|
if DEBUG:
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.mysql',
|
|
'NAME': 'cfdi_as',
|
|
'USER': 'root',
|
|
'PASSWORD': 'Soluciones28@',
|
|
'HOST': '127.0.0.1',
|
|
'PORT': '',
|
|
'OPTIONS': {'init_command': "SET sql_mode='STRICT_TRANS_TABLES'"},
|
|
},
|
|
}
|
|
else:
|
|
DATABASES={
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.mysql',
|
|
'NAME': 'fjrodriguez$cfdi_as',
|
|
'USER': 'fjrodriguez',
|
|
'PASSWORD': 'Soluciones28@',
|
|
'HOST': 'fjrodriguez.mysql.pythonanywhere-services.com',
|
|
'PORT': '3306',
|
|
'OPTIONS': {'init_command': "SET sql_mode='STRICT_TRANS_TABLES'"},
|
|
}
|
|
}
|
|
|
|
|
|
# Password validation
|
|
# https://docs.djangoproject.com/en/4.1/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/4.1/topics/i18n/
|
|
|
|
LANGUAGE_CODE = 'es-MX'
|
|
|
|
TIME_ZONE = 'CST6CDT'
|
|
|
|
USE_I18N = True
|
|
|
|
USE_TZ = True
|
|
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
# https://docs.djangoproject.com/en/4.1/howto/static-files/
|
|
|
|
if not DEBUG:
|
|
#STATIC_ROOT = os.path.join(BASE_DIR, "static")
|
|
STATICFILES_DIRS = [
|
|
BASE_DIR / 'static'
|
|
]
|
|
|
|
MEDIA_URL = '/media/'
|
|
MEDIA_ROOT = BASE_DIR / 'media'
|
|
STATIC_URL = '/static/'
|
|
if DEBUG:
|
|
|
|
STATICFILES_DIRS = [
|
|
BASE_DIR / 'static',
|
|
]
|
|
MEDIA_URL = '/media/'
|
|
MEDIA_ROOT = BASE_DIR / 'media'
|
|
STATIC_URL = '/static/'
|
|
#STATIC_ROOT = os.path.join(BASE_DIR, "static")
|
|
|
|
|
|
|
|
# Default primary key field type
|
|
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
|
|
|
|
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|