Advertisement
Guest User

Untitled

a guest
Sep 5th, 2019
392
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.18 KB | None | 0 0
  1. """
  2. Django settings for footters project.
  3.  
  4. Generated by 'django-admin startproject' using Django 2.2.5.
  5.  
  6. For more information on this file, see
  7. https://docs.djangoproject.com/en/2.2/topics/settings/
  8.  
  9. For the full list of settings and their values, see
  10. https://docs.djangoproject.com/en/2.2/ref/settings/
  11. """
  12.  
  13. import os
  14. import smuggler
  15. import django_heroku
  16. import whitenoise
  17.  
  18. # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  19. BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  20.  
  21.  
  22. # Quick-start development settings - unsuitable for production
  23. # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
  24.  
  25. # SECURITY WARNING: keep the secret key used in production secret!
  26. SECRET_KEY = '6mlgtjs6!vax6(zn@(d%3oy_6iv)%he*tj6b-@zwx(#zfi*#f2'
  27.  
  28. if 'DYNO' in os.environ:
  29. BASEURL = 'https://footters-manager.herokuapp.com/'
  30. # SECURITY WARNING: don't run with debug turned on in production!
  31. if 'DYNO' in os.environ:
  32. DEBUG = False
  33. else:
  34. DEBUG = False
  35.  
  36. if 'DYNO' in os.environ:
  37. SECURE_SSL_REDIRECT = True
  38. SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
  39.  
  40. ALLOWED_HOSTS = ['localhost', '127.0.0.1','http://footters-manager.herokuapp.com/']
  41. VERSION=2
  42.  
  43.  
  44.  
  45. # Application definition
  46.  
  47. INSTALLED_APPS = [
  48. 'admin_shortcuts',
  49. 'django.contrib.admin',
  50. 'django.contrib.auth',
  51. 'django.contrib.contenttypes',
  52. 'django.contrib.sessions',
  53. 'django.contrib.messages',
  54. 'django.contrib.staticfiles',
  55. 'footters_app.apps.FoottersAppConfig',
  56. "colorfield",
  57. 'smuggler',
  58. 'rest_framework',
  59. ]
  60.  
  61. MIDDLEWARE = [
  62. 'django.middleware.security.SecurityMiddleware',
  63. 'whitenoise.middleware.WhiteNoiseMiddleware',
  64. 'django.contrib.sessions.middleware.SessionMiddleware',
  65. 'django.middleware.common.CommonMiddleware',
  66. 'django.middleware.csrf.CsrfViewMiddleware',
  67. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  68. 'django.contrib.messages.middleware.MessageMiddleware',
  69. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  70. ]
  71.  
  72. SMUGGLER_FIXTURE_DIR = 'footters_app/fixtures'
  73.  
  74. ROOT_URLCONF = 'footters.urls'
  75.  
  76. TEMPLATES = [
  77. {
  78. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  79. 'DIRS': [os.path.join(BASE_DIR, 'templates')]
  80. ,
  81. 'APP_DIRS': True,
  82. 'OPTIONS': {
  83. 'context_processors': [
  84. 'django.template.context_processors.debug',
  85. 'django.template.context_processors.request',
  86. 'django.contrib.auth.context_processors.auth',
  87. 'django.contrib.messages.context_processors.messages',
  88. ],
  89. },
  90. },
  91. ]
  92.  
  93. WSGI_APPLICATION = 'footters.wsgi.application'
  94.  
  95.  
  96. ADMIN_SHORTCUTS = [
  97. {
  98. 'shortcuts': [
  99. {
  100. 'url': '/admin',
  101. 'icon': 'home'
  102. },
  103. {
  104. 'url_name': 'admin:logout',
  105. },
  106. {
  107. 'title': 'Usuarios',
  108. 'url_name': 'admin:auth_user_changelist',
  109. 'count': 'footters_app.admin_methods.count_users',
  110. },
  111. {
  112. 'title': 'Grupos',
  113. 'url_name': 'admin:auth_group_changelist',
  114. 'count': 'footters_app.admin_methods.count_groups',
  115. },
  116. {
  117. 'title': 'Añadir usuario',
  118. 'url_name': 'admin:auth_user_add',
  119. 'has_perms': 'footters_app.admin_methods.has_perms_to_users',
  120. },
  121. ]
  122. },
  123. {
  124. 'title': 'Utilidades',
  125. 'shortcuts': [
  126. {
  127. 'title': 'Documentación',
  128. 'icon': 'book',
  129. 'url_name': 'admin:index',
  130. },
  131. {
  132. 'title': 'Descargar datos',
  133. 'icon': 'download',
  134. 'url_name': ['dumpdata', "footters_app,auth"],
  135. },
  136. {
  137. 'title': 'Cargar datos',
  138. 'icon': 'upload',
  139. 'url_name': 'load-data',
  140. # 'count_new': '3',
  141. },
  142. {
  143. 'title': 'Añadir equipo real',
  144. 'url_name': 'admin:footters_app_equiporeal_add',
  145. 'icon': 'shield-alt'
  146. },
  147. {
  148. 'title': 'Añadir jugador',
  149. 'url_name': 'admin:footters_app_jugador_add',
  150. 'icon': 'futbol'
  151. },
  152. ]
  153. },
  154. ]
  155.  
  156. REST_FRAMEWORK = {
  157. # Use Django's standard `django.contrib.auth` permissions,
  158. # or allow read-only access for unauthenticated users.
  159. 'DEFAULT_PERMISSION_CLASSES': [
  160. 'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
  161. ]
  162. }
  163.  
  164. ADMIN_SHORTCUTS_SETTINGS = {
  165. 'show_on_all_pages': True,
  166. 'hide_app_list': False,
  167. 'open_new_window': False,
  168. }
  169.  
  170. # Database
  171. # https://docs.djangoproject.com/en/2.2/ref/settings/#databases
  172.  
  173. DATABASES = {
  174. 'default': {
  175. 'ENGINE': 'django.db.backends.sqlite3',
  176. 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
  177. }
  178. }
  179.  
  180.  
  181. django_heroku.settings(locals())
  182.  
  183.  
  184. # Password validation
  185. # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
  186.  
  187. AUTH_PASSWORD_VALIDATORS = [
  188. {
  189. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  190. },
  191. {
  192. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  193. },
  194. {
  195. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  196. },
  197. {
  198. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  199. },
  200. ]
  201.  
  202.  
  203. # Internationalization
  204. # https://docs.djangoproject.com/en/2.2/topics/i18n/
  205.  
  206. LANGUAGE_CODE = 'es-es'
  207.  
  208. TIME_ZONE = 'UTC'
  209.  
  210. USE_I18N = True
  211.  
  212. USE_L10N = True
  213.  
  214. USE_TZ = True
  215.  
  216.  
  217. # Static files (CSS, JavaScript, Images)
  218. # https://docs.djangoproject.com/en/2.2/howto/static-files/
  219.  
  220. WSGI_APPLICATION = 'footters_app.wsgi.application'
  221.  
  222.  
  223. STATICFILES_DIRS = [
  224. os.path.join(BASE_DIR, 'static')
  225. ]
  226. PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
  227. STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement