Advertisement
Guest User

Base.py

a guest
Sep 20th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 6.81 KB | None | 0 0
  1. """
  2. Django settings for pac_gateway project.
  3.  
  4. Generated by 'django-admin startproject' using Django 1.9.5.
  5.  
  6. For more information on this file, see
  7. https://docs.djangoproject.com/en/1.9/topics/settings/
  8.  
  9. For the full list of settings and their values, see
  10. https://docs.djangoproject.com/en/1.9/ref/settings/
  11. """
  12.  
  13. import os
  14.  
  15. DEBUG = False
  16.  
  17. if os.environ.get('DJANGO_DEBUG', False):
  18.     DEBUG = True
  19.  
  20. # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  21. BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  22.  
  23. # Quick-start development settings - unsuitable for production
  24. # See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
  25.  
  26. # SECURITY WARNING: keep the secret key used in production secret!
  27. SECRET_KEY = 'nbqoc-^@f#1(g#cux^w*$%14opecsr8np@m^h2vykctm+76!pw'
  28.  
  29. ALLOWED_HOSTS = []
  30.  
  31. # Application definition
  32.  
  33. INSTALLED_APPS = [
  34.     'django.contrib.admin',
  35.     'django.contrib.auth',
  36.     'django.contrib.contenttypes',
  37.     'django.contrib.sessions',
  38.     'django.contrib.messages',
  39.     'django.contrib.staticfiles',
  40.     'django.contrib.postgres',
  41.     'rest_framework.authtoken',
  42.     'rest_framework',
  43.     'corsheaders',
  44.     'rest_framework_swagger',
  45.     'anymail',
  46.     'pac_gateway.cfd',
  47.     'daterange_filter',
  48.     'colorfield',
  49.     'colorful'
  50. ]
  51.  
  52. MIDDLEWARE_CLASSES = [
  53.     'django.middleware.security.SecurityMiddleware',
  54.     'django.contrib.sessions.middleware.SessionMiddleware',
  55.     'corsheaders.middleware.CorsMiddleware',
  56.     'django.middleware.common.CommonMiddleware',
  57.     'django.middleware.csrf.CsrfViewMiddleware',
  58.     'django.contrib.auth.middleware.AuthenticationMiddleware',
  59.     'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
  60.     'django.contrib.messages.middleware.MessageMiddleware',
  61.     'django.middleware.clickjacking.XFrameOptionsMiddleware',
  62. ]
  63.  
  64. CORS_ORIGIN_ALLOW_ALL = True
  65. CORS_ALLOW_CREDENTIALS = True
  66.  
  67. ROOT_URLCONF = 'pac_gateway.urls'
  68.  
  69. TEMPLATES = [
  70.     {
  71.         'BACKEND': 'django.template.backends.django.DjangoTemplates',
  72.         'DIRS': [os.path.join(BASE_DIR, 'templates'), ],
  73.         'APP_DIRS': True,
  74.         'OPTIONS': {
  75.             'context_processors': [
  76.                 'django.template.context_processors.debug',
  77.                 'django.template.context_processors.request',
  78.                 'django.contrib.auth.context_processors.auth',
  79.                 'django.contrib.messages.context_processors.messages',
  80.             ],
  81.             'debug': DEBUG
  82.         },
  83.     },
  84. ]
  85.  
  86. WSGI_APPLICATION = 'pac_gateway.wsgi.application'
  87.  
  88. # Password validation
  89. # https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
  90.  
  91. AUTH_PASSWORD_VALIDATORS = [
  92.     {
  93.         'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  94.     },
  95.     {
  96.         'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  97.     },
  98.     {
  99.         'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  100.     },
  101.     {
  102.         'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  103.     },
  104. ]
  105.  
  106. # Internationalization
  107. # https://docs.djangoproject.com/en/1.9/topics/i18n/
  108.  
  109. LANGUAGE_CODE = 'es'
  110.  
  111. TIME_ZONE = 'UTC'
  112.  
  113. USE_I18N = True
  114.  
  115. # USE_L10N = True
  116.  
  117. USE_TZ = True
  118.  
  119. LOCALE_PATHS = (
  120.     os.path.join(BASE_DIR, 'locale'),
  121. )
  122.  
  123. # Static files (CSS, JavaScript, Images)
  124. # https://docs.djangoproject.com/en/1.9/howto/static-files/
  125.  
  126. STATIC_URL = '/static/'
  127. STATIC_ROOT = os.path.join(BASE_DIR, 'static')
  128.  
  129. # Rest Framework
  130.  
  131. REST_FRAMEWORK = {
  132.     'DEFAULT_PERMISSION_CLASSES': (
  133.         'rest_framework.permissions.IsAuthenticated',
  134.     ),
  135.     'DEFAULT_FILTER_BACKENDS': (
  136.         'rest_framework.filters.DjangoFilterBackend',
  137.         'rest_framework.filters.SearchFilter'
  138.     ),
  139.     'DEFAULT_AUTHENTICATION_CLASSES': (
  140.         'rest_framework.authentication.SessionAuthentication',
  141.         'rest_framework.authentication.TokenAuthentication'
  142.     ),
  143.     'DEFAULT_PAGINATION_CLASS': (
  144.         'rest_framework.pagination.LimitOffsetPagination'
  145.     )
  146. }
  147.  
  148. LOGIN_REDIRECT_URL = "/api/docs/"
  149.  
  150. # PAC Gateway setup
  151. CFDI_DEFAULT_VERSION = '3.2'
  152. CFDI_IR_SCHEMA_PATH = os.path.join(BASE_DIR, 'share', 'schemas',
  153.                                    'comprobante.json')
  154.  
  155. PAC_GATEWAY_ENCRYPTION_KEY = os.environ.get('PAC_GATEWAY_ENCRYPTION_KEY', '')
  156.  
  157. FINKOK_USERNAME = os.environ.get('FINKOK_USERNAME', '')
  158. FINKOK_PASSWORD = os.environ.get('FINKOK_PASSWORD', '')
  159.  
  160. PAC_GATEWAY_AVAIL_SHEETS_WARNING_PCT = 0.125
  161.  
  162. PAC_GATEWAY_DEFAULT_CERTIFICATION_DAYS = 3
  163.  
  164. PAC_GATEWAY_FROM_EMAIL = "support@f-ambit.mx"
  165.  
  166. # SAT Formats
  167. SAT_DATE_FORMAT = '%Y-%m-%dT%H:%M:%S'
  168.  
  169. # Default prefixes
  170. PAC_GATEWAY_DEFAULT_GLOBAL_INVOICE_PREFIX = 'FG'
  171. PAC_GATEWAY_DEFAULT_GLOBAL_CREDIT_NOTE_PREFIX = 'NCG'
  172. PAC_GATEWAY_DEFAULT_CREDIT_NOTE_PREFIX = 'NC'
  173.  
  174. # Payment form strings
  175. PAC_GATEWAY_PAYMENT_FORM_SINGLE = 'Pago en una sola exhibición'
  176. PAC_GATEWAY_PAYMENT_FORM_MULTIPLE = 'Parcialidad {part} de {total_parts}'
  177.  
  178. # Invoice defaults
  179. PAC_GATEWAY_DEFAULT_SAT_PAYMENT_METHOD = '01'
  180. PAC_GATEWAY_DEFAULT_UNIT = 'Unidad'
  181.  
  182. PAC_GATEWAY_INSTALLED_APPS = {
  183.     'lightspeed-retail': ('pac_gateway.applications.lightspeed'
  184.                           '.retail.LightSpeedRetailHandler')
  185. }
  186.  
  187. DEFAULT_PAF_CONFIG = {
  188.     'palette': {
  189.         'bg': '#F9F9F9',
  190.         'header_bg': '#FDFDFD',
  191.         'container_bg': '#FFFFFF',
  192.         'title_bg': '#E31818',
  193.         'form_footer_bg': '#F5F5F5',
  194.         'footer_bg': '#FDFDFD',
  195.         'primary_button_bg': '#E31818',
  196.         'secondary_button_bg': '#A0A0A0',
  197.         'font_color': '#838383',
  198.         'title_color': '#FFFFFF',
  199.         'link_color': '#337AB7',
  200.         'primary_button_color': '#FFFFFF',
  201.         'secondary_button_color': '#FFFFFF',
  202.         'form_footer_color': '#838383',
  203.         'footer_color': '#838383'
  204.     }
  205. }
  206.  
  207. # Invoice PDF setup
  208.  
  209. INVOICE_PDF_PAGESIZE = 'letter'
  210. INVOICE_PDF_ORIENTATION = 'portrait'
  211. INVOICE_PDF_MARGIN = '1cm'
  212. INVOICE_PDF_PADDING = '0'
  213.  
  214. # Swagger settings
  215. SWAGGER_SETTINGS = {
  216.     'api_version': '0.1',
  217.     'api_path': '/api/v1/',
  218.     'enabled_methods': [
  219.         'get',
  220.         'post',
  221.     ],
  222.     'is_authenticated': True,
  223.     'permission_denied_handler': 'pac_gateway.cfd.views.permission_denied_handler',
  224.     'info': {
  225.         'contact': 'team@uakami.com',
  226.         'description': 'API Pac Gateway to search, claim and stamp invoices. ',
  227.         # 'license': 'Apache 2.0',
  228.         # 'licenseUrl': 'http://www.apache.org/licenses/LICENSE-2.0.html',
  229.         # 'termsOfServiceUrl': 'http://helloreverb.com/terms/',
  230.         'title': 'Ambit - API Pac Gateway',
  231.     }
  232. }
  233.  
  234. # Anymail settings
  235. ANYMAIL = {
  236.     "MAILGUN_API_KEY": os.environ.get('MAILGUN_API_KEY', None)
  237. }
  238.  
  239. EMAIL_BACKEND = "anymail.backends.mailgun.MailgunBackend"
  240. DEFAULT_FROM_EMAIL = "no-reply@f-ambit.mx"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement