Advertisement
Guest User

Untitled

a guest
Jun 16th, 2017
641
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 11.46 KB | None | 0 0
  1. settings_local.py
  2.  
  3. Alexander Pitkin, [16.06.17 12:50]
  4. # Django settings for quidlum_com project.
  5. import settings
  6. import os
  7.  
  8. # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  9. BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  10.  
  11. DEBUG = True
  12. TEMPLATE_DEBUG = DEBUG
  13. ALLOW_SIGNUP = True
  14. DEBUG_TOOLBAR_PATCH_SETTINGS = False
  15. GA_PROFILE_ID = 'ga:72031822'
  16. CORS_ORIGIN_ALLOW_ALL = True
  17.  
  18. ADMINS = (
  19.     # ('Your Name', 'your_email@example.com'),
  20. )
  21.  
  22. MANAGERS = ADMINS
  23. SOCIALACCOUNT_PROVIDERS = settings.SOCIALACCOUNT_PROVIDERS
  24. DATABASES = {
  25.     'default': {
  26.         'ENGINE': 'django.db.backends.postgresql_psycopg2',  # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
  27.         'NAME': 'quidlum',
  28.         'USER': '',
  29.         'PASSWORD': '',
  30.         'HOST': "127.0.0.1",
  31.         'PORT': '5432',
  32.     }
  33. }
  34.  
  35. # Local time zone for this installation. Choices can be found here:
  36. # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
  37. # although not all choices may be available on all operating systems.
  38. # In a Windows environment this must be set to your system time zone.
  39. TIME_ZONE = 'UTC'
  40.  
  41. # Language code for this installation. All choices can be found here:
  42. # http://www.i18nguy.com/unicode/language-identifiers.html
  43. LANGUAGE_CODE = 'en-us'
  44.  
  45. SITE_ID = 1
  46.  
  47. # If you set this to False, Django will make some optimizations so as not
  48. # to load the internationalization machinery.
  49. USE_I18N = True
  50.  
  51. # If you set this to False, Django will not format dates, numbers and
  52. # calendars according to the current locale.
  53. USE_L10N = True
  54.  
  55. # If you set this to False, Django will not use timezone-aware datetimes.
  56. USE_TZ = True
  57.  
  58. # Absolute filesystem path to the directory that will hold user-uploaded files.
  59. # Example: "/home/media/media.lawrence.com/media/"
  60. MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
  61.  
  62. # URL that handles the media served from MEDIA_ROOT. Make sure to use a
  63. # trailing slash.
  64. # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
  65. # MEDIA_URL = 'https://quidlumdev.s3.amazonaws.com/media/'
  66. MEDIA_URL = '/media/'
  67.  
  68. FILE_UPLOAD_PERMISSIONS = 0644
  69. # Absolute path to the directory static files should be collected to.
  70. # Don't put anything in this directory yourself; store your static files
  71. # in apps' "static/" subdirectories and in STATICFILES_DIRS.
  72. # Example: "/home/media/media.lawrence.com/static/"
  73. STATIC_ROOT = os.path.join(BASE_DIR, 'static')
  74.  
  75. # URL prefix for static files.
  76. # Example: "http://media.lawrence.com/static/"
  77. STATIC_URL = '/static/'
  78.  
  79. # Additional locations of static files
  80. STATICFILES_DIRS = (
  81.     # Put strings here, like "/home/html/static" or "C:/www/django/static".
  82.     # Always use forward slashes, even on Windows.
  83.     # Don't forget to use absolute paths, not relative paths.
  84. )
  85.  
  86. Wikipedia
  87. List of tz database time zones
  88. This is a list of time zones in the tz database release 2017b. The list is derived from the zones, links, and rules specified in zone.tab and the 7 "c...
  89. # List of finder classes that know how to find static files in
  90. # various locations.
  91. STATICFILES_FINDERS = (
  92.    'django.contrib.staticfiles.finders.FileSystemFinder',
  93.    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
  94.    #   'django.contrib.staticfiles.finders.DefaultStorageFinder',
  95. )
  96.  
  97. # Make this unique, and don't share it with anybody.
  98. SECRET_KEY = '@bm9#!lhv1o0gh86^%xtwf23&b7@46w6o2z_3j-@(#6fvjxi@e'
  99.  
  100. # List of callables that know how to import templates from various sources.
  101. TEMPLATE_LOADERS = (
  102.    'django_mobile.loader.Loader',
  103.    'django.template.loaders.filesystem.Loader',
  104.    'django.template.loaders.app_directories.Loader',
  105.    # 'django.templates.loaders.eggs.Loader',
  106.    # 'coffin.template.loaders.',
  107. )
  108.  
  109. Alexander Pitkin, [16.06.17 12:50]
  110. TEMPLATE_CONTEXT_PROCESSORS = (
  111.    # "cumulus.context_processors.cdn_url",
  112.    "django.contrib.auth.context_processors.auth",
  113.    "django.core.context_processors.debug",
  114.    "django.core.context_processors.i18n",
  115.    "django.core.context_processors.media",
  116.    "django.core.context_processors.static",
  117.    "django.core.context_processors.tz",
  118.    "django.contrib.messages.context_processors.messages",
  119.    "django.core.context_processors.request",
  120.    # "allauth.account.context_processors.account",
  121.    # "allauth.socialaccount.context_processors.socialaccount",
  122.    "django_mobile.context_processors.flavour",
  123.    "django.core.context_processors.csrf",
  124.  
  125. )
  126.  
  127. MIDDLEWARE_CLASSES = (
  128.    'django_hosts.middleware.HostsRequestMiddleware',
  129.    'corsheaders.middleware.CorsMiddleware',
  130.    'django.middleware.common.CommonMiddleware',
  131.    'django.contrib.sessions.middleware.SessionMiddleware',
  132.    'django.middleware.csrf.CsrfViewMiddleware',
  133.    'django.contrib.auth.middleware.AuthenticationMiddleware',
  134.    'django.contrib.messages.middleware.MessageMiddleware',
  135.    'django.middleware.clickjacking.XFrameOptionsMiddleware',
  136.    'django_mobile.middleware.MobileDetectionMiddleware',
  137.    'django_mobile.middleware.SetFlavourMiddleware',
  138.    'django_hosts.middleware.HostsResponseMiddleware',
  139. )
  140. if DEBUG:
  141.    MIDDLEWARE_CLASSES += (
  142.        'debug_toolbar.middleware.DebugToolbarMiddleware',
  143.    )
  144. ROOT_URLCONF = 'quidlum_com.urls'
  145.  
  146. ROOT_HOSTCONF = 'quidlum_com.hosts'
  147.  
  148. DEFAULT_HOST = 'dev'
  149.  
  150. SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
  151.  
  152. # Python dotted path to the WSGI application used by Django's runserver.
  153. WSGI_APPLICATION = 'quidlum_com.wsgi.application'
  154.  
  155. TEMPLATE_DIRS = (
  156.    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
  157.    # Always use forward slashes, even on Windows.
  158.    # Don't forget to use absolute paths, not relative paths.
  159. )
  160.  
  161. INSTALLED_APPS = settings.INSTALLED_APPS
  162.  
  163. AUTHENTICATION_BACKENDS = (
  164.    # Needed to login by username in Django admin, regardless of allauth
  165.    "django.contrib.auth.backends.ModelBackend",
  166.  
  167.    # allauth specific authentication methods, such as login by e-mail
  168.    "allauth.account.auth_backends.AuthenticationBackend",
  169. )
  170.  
  171. # A sample logging configuration. The only tangible logging
  172. # performed by this configuration is to send an email to
  173. # the site admins on every HTTP 500 error when DEBUG=False.
  174. # See http://docs.djangoproject.com/en/dev/topics/logging for
  175. # more details on how to customize your logging configuration.
  176. '''LOGGING = {
  177.    'version': 1,
  178.    'disable_existing_loggers': False,
  179.    'filters': {
  180.        'require_debug_false': {
  181.            '()': 'django.utils.log.RequireDebugFalse'
  182.        }
  183.    },
  184.    'handlers': {
  185.        'mail_admins': {
  186.            'level': 'ERROR',
  187.            'filters': ['require_debug_false'],
  188.            'class': 'django.utils.log.AdminEmailHandler'
  189.        }
  190.    },
  191.    'loggers': {
  192.        'django.request': {
  193.            'handlers': ['mail_admins'],
  194.            'level': 'ERROR',
  195.            'propagate': True,
  196.        },
  197.    }
  198. }'''
  199. Alexander Pitkin, [16.06.17 12:50]
  200. LOGGING = {
  201.    'version': 1,
  202.    'disable_existing_loggers': True,
  203.    'formatters': {
  204.        'standard': {
  205.            'format': "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
  206.            'datefmt': "%d/%b/%Y %H:%M:%S"
  207.        },
  208.    },
  209.    'handlers': {
  210.        'null': {
  211.            'level': 'DEBUG',
  212.            'class': 'django.utils.log.NullHandler',
  213.        },
  214.        'logfile': {
  215.            'level': 'DEBUG',
  216.            'class': 'logging.handlers.RotatingFileHandler',
  217.            'filename': "logfile",
  218.            'maxBytes': 50000,
  219.            'backupCount': 2,
  220.            'formatter': 'standard',
  221.        },
  222.        'console': {
  223.            'level': 'INFO',
  224.            'class': 'logging.StreamHandler',
  225.            'formatter': 'standard'
  226.        },
  227.    },
  228.    'loggers': {
  229.        'django': {
  230.            'handlers': ['console'],
  231.            'propagate': True,
  232.            'level': 'WARN',
  233.        },
  234.        'django.db.backends': {
  235.            'handlers': ['console'],
  236.            'level': 'DEBUG',
  237.            'propagate': False,
  238.        },
  239.        'celery': {
  240.            'handlers': ['logfile', 'console'],
  241.            'level': 'DEBUG',
  242.        },
  243.        '': {
  244.            'handlers': ['console', 'logfile'],
  245.            'level': 'DEBUG',
  246.        },
  247.    }
  248. }
  249. CELERY_RESULT_BACKEND = 'djcelery.backends.database:DatabaseBackend'
  250. # Authaticate using custom user model
  251. AUTH_USER_MODEL = 'qcore.QUser'
  252.  
  253. # login url
  254. LOGIN_URL = '/'
  255. LOGIN_REDIRECT_URL = '/'
  256.  
  257. # allauth settings
  258. ACCOUNT_AUTHENTICATION_METHOD = "email"
  259. ACCOUNT_DEFAULT_HTTP_PROTOCOL = "http"
  260. ACCOUNT_EMAIL_REQUIRED = True
  261. ACCOUNT_EMAIL_VERIFICATION = "optional"
  262. ACCOUNT_SIGNUP_FORM_CLASS = 'qcore.forms.SignupForm'
  263. ACCOUNT_USERNAME_REQUIRED = False
  264. ACCOUNT_PASSWORD_MIN_LENGTH = 8
  265. SOCIALACCOUNT_QUERY_EMAIL = True
  266. SOCIALACCOUNT_AUTO_SIGNUP = True
  267. # NEXT variable fix:
  268. ACCOUNT_ADAPTER = 'qcore.overloads.NextFixAdapter'
  269.  
  270. # # Email settings
  271. # EMAIL_HOST = 'smtp.gmail.com'
  272. # EMAIL_PORT = 587
  273. # EMAIL_HOST_USER = 'noreply@quidlum.com'
  274. # EMAIL_HOST_PASSWORD = 'tGI48uUxYRj53fj17AR6'
  275. # EMAIL_USE_TLS = True
  276.  
  277. # BROKER_URL = 'amqp://quidlum-task:bMzMTbg7ZVBhcbEewaYs@ip-172-31-8-35.us-west-2.compute.internal:5672/dev_tasks'
  278.  
  279. # DEFAULT_FILE_STORAGE = 'quidlum_com.s3utils.MediaS3BotoStorage'
  280. # STATICFILES_STORAGE = 'quidlum_com.s3utils.StaticS3BotoStorage'
  281.  
  282. # AWS_ACCESS_KEY_ID = 'AKIAJSG5SPYPW4XBUKXQ'
  283. # AWS_SECRET_ACCESS_KEY = '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'
  284. # AWS_STORAGE_BUCKET_NAME = 'quidlumdev'
  285. # AWS_QUERYSTRING_AUTH = False
  286.  
  287. NOTIFICATIONS_USE_JSONFIELD = True
  288.  
  289. if DEBUG:
  290.    def show_toolbar(request):
  291.        return True
  292.  
  293.  
  294.    DEBUG_TOOLBAR_PANELS = [
  295.        'debug_toolbar.panels.versions.VersionsPanel',
  296.        'debug_toolbar.panels.timer.TimerPanel',
  297.        'debug_toolbar.panels.settings.SettingsPanel',
  298.        'debug_toolbar.panels.headers.HeadersPanel',
  299.        'debug_toolbar.panels.request.RequestPanel',
  300.        'debug_toolbar.panels.sql.SQLPanel',
  301.        # 'debug_toolbar.panels.staticfiles.StaticFilesPanel',
  302.        'debug_toolbar.panels.templates.TemplatesPanel',
  303.        'debug_toolbar.panels.cache.CachePanel',
  304.        # 'debug_toolbar.panels.signals.SignalsPanel',
  305.        # 'debug_toolbar.panels.logging.LoggingPanel',
  306.        # 'debug_toolbar.panels.redirects.RedirectsPanel',
  307.        'debug_toolbar.panels.profiling.ProfilingPanel',
  308.    ]
  309. Alexander Pitkin, [16.06.17 12:50]
  310. DEBUG_TOOLBAR_CONFIG = {
  311.        # ...
  312.        'SHOW_TOOLBAR_CALLBACK': "%s.show_toolbar" % __name__,
  313.        'DISABLE_PANELS': set(['debug_toolbar.panels.versions.VersionsPanel',
  314.                               'debug_toolbar.panels.timer.TimerPanel',
  315.                               'debug_toolbar.panels.settings.SettingsPanel',
  316.                               'debug_toolbar.panels.headers.HeadersPanel',
  317.                               'debug_toolbar.panels.request.RequestPanel',
  318.                               'debug_toolbar.panels.sql.SQLPanel',
  319.                               # 'debug_toolbar.panels.staticfiles.StaticFilesPanel',
  320.                               'debug_toolbar.panels.templates.TemplatesPanel',
  321.                               'debug_toolbar.panels.cache.CachePanel',
  322.                               # 'debug_toolbar.panels.signals.SignalsPanel',
  323.                               # 'debug_toolbar.panels.logging.LoggingPanel',
  324.                               # 'debug_toolbar.panels.redirects.RedirectsPanel',
  325.                               'debug_toolbar.panels.profiling.ProfilingPanel', ])
  326.    }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement