Advertisement
Guest User

Untitled

a guest
Aug 29th, 2017
473
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 12.80 KB | None | 0 0
  1. root@dask:/home/dask/www/code/daskretreats_org# cat settings.py
  2.  
  3. from __future__ import absolute_import, unicode_literals
  4. import os
  5.  
  6. from django import VERSION as DJANGO_VERSION
  7. from django.utils.translation import ugettext_lazy as _
  8.  
  9. with open("/home/dask/www/secrets/server_key") as server_key_file:
  10.     SECRET_KEY = server_key_file.read().strip()
  11. with open("/home/dask/www/secrets/rollbar_key") as rollbar_key_file:
  12.     ROLLBAR_KEY = rollbar_key_file.read().strip()
  13. with open("/home/dask/www/secrets/postgres_key") as postgres_key_file:
  14.     POSTGRES_KEY = postgres_key_file.read().strip()
  15.  
  16. ######################
  17. # MEZZANINE SETTINGS #
  18. ######################
  19.  
  20. # The following settings are already defined with default values in
  21. # the ``defaults.py`` module within each of Mezzanine's apps, but are
  22. # common enough to be put here, commented out, for conveniently
  23. # overriding. Please consult the settings documentation for a full list
  24. # of settings Mezzanine implements:
  25. # http://mezzanine.jupo.org/docs/configuration.html#default-settings
  26.  
  27. # Controls the ordering and grouping of the admin menu.
  28. #
  29. # ADMIN_MENU_ORDER = (
  30. #     ("Content", ("pages.Page", "blog.BlogPost",
  31. #        "generic.ThreadedComment", (_("Media Library"), "media-library"),)),
  32. #     ("Site", ("sites.Site", "redirects.Redirect", "conf.Setting")),
  33. #     ("Users", ("auth.User", "auth.Group",)),
  34. # )
  35.  
  36. # A three item sequence, each containing a sequence of template tags
  37. # used to render the admin dashboard.
  38. #
  39. # DASHBOARD_TAGS = (
  40. #     ("blog_tags.quick_blog", "mezzanine_tags.app_list"),
  41. #     ("comment_tags.recent_comments",),
  42. #     ("mezzanine_tags.recent_actions",),
  43. # )
  44.  
  45. # A sequence of templates used by the ``page_menu`` template tag. Each
  46. # item in the sequence is a three item sequence, containing a unique ID
  47. # for the template, a label for the template, and the template path.
  48. # These templates are then available for selection when editing which
  49. # menus a page should appear in. Note that if a menu template is used
  50. # that doesn't appear in this setting, all pages will appear in it.
  51.  
  52. # PAGE_MENU_TEMPLATES = (
  53. #     (1, _("Top navigation bar"), "pages/menus/dropdown.html"),
  54. #     (2, _("Left-hand tree"), "pages/menus/tree.html"),
  55. #     (3, _("Footer"), "pages/menus/footer.html"),
  56. # )
  57.  
  58. # A sequence of fields that will be injected into Mezzanine's (or any
  59. # library's) models. Each item in the sequence is a four item sequence.
  60. # The first two items are the dotted path to the model and its field
  61. # name to be added, and the dotted path to the field class to use for
  62. # the field. The third and fourth items are a sequence of positional
  63. # args and a dictionary of keyword args, to use when creating the
  64. # field instance. When specifying the field class, the path
  65. # ``django.models.db.`` can be omitted for regular Django model fields.
  66. #
  67. # EXTRA_MODEL_FIELDS = (
  68. #     (
  69. #         # Dotted path to field.
  70. #         "mezzanine.blog.models.BlogPost.image",
  71. #         # Dotted path to field class.
  72. #         "somelib.fields.ImageField",
  73. #         # Positional args for field class.
  74. #         (_("Image"),),
  75. #         # Keyword args for field class.
  76. #         {"blank": True, "upload_to": "blog"},
  77. #     ),
  78. #     # Example of adding a field to *all* of Mezzanine's content types:
  79. #     (
  80. #         "mezzanine.pages.models.Page.another_field",
  81. #         "IntegerField", # 'django.db.models.' is implied if path is omitted.
  82. #         (_("Another name"),),
  83. #         {"blank": True, "default": 1},
  84. #     ),
  85. # )
  86.  
  87. # Setting to turn on featured images for blog posts. Defaults to False.
  88. #
  89. # BLOG_USE_FEATURED_IMAGE = True
  90.  
  91. # If True, the django-modeltranslation will be added to the
  92. # INSTALLED_APPS setting.
  93. USE_MODELTRANSLATION = False
  94.  
  95.  
  96. ########################
  97. # MAIN DJANGO SETTINGS #
  98. ########################
  99.  
  100. # Hosts/domain names that are valid for this site; required if DEBUG is False
  101. # See https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
  102. ALLOWED_HOSTS = [
  103.         "www.daskretreats.org",
  104.         "www.daskretreats.com",
  105. ]
  106.  
  107. # Local time zone for this installation. Choices can be found here:
  108. # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
  109. # although not all choices may be available on all operating systems.
  110. # On Unix systems, a value of None will cause Django to use the same
  111. # timezone as the operating system.
  112. # If running in a Windows environment this must be set to the same as your
  113. # system time zone.
  114. TIME_ZONE = 'America/Chicago'
  115.  
  116. # If you set this to True, Django will use timezone-aware datetimes.
  117. USE_TZ = True
  118.  
  119. # Language code for this installation. All choices can be found here:
  120. # http://www.i18nguy.com/unicode/language-identifiers.html
  121. LANGUAGE_CODE = "en"
  122.  
  123. # Supported languages
  124. LANGUAGES = (
  125.     ('en', _('English')),
  126. )
  127.  
  128. # A boolean that turns on/off debug mode. When set to ``True``, stack traces
  129. # are displayed for error pages. Should always be set to ``False`` in
  130. # production. Best set to ``True`` in local_settings.py
  131. DEBUG = False
  132.  
  133. # Whether a user's session cookie expires when the Web browser is closed.
  134. SESSION_EXPIRE_AT_BROWSER_CLOSE = True
  135.  
  136. SITE_ID = 1
  137.  
  138. # If you set this to False, Django will make some optimizations so as not
  139. # to load the internationalization machinery.
  140. USE_I18N = False
  141.  
  142. AUTHENTICATION_BACKENDS = ("mezzanine.core.auth_backends.MezzanineBackend",)
  143.  
  144. # The numeric mode to set newly-uploaded files to. The value should be
  145. # a mode you'd pass directly to os.chmod.
  146. FILE_UPLOAD_PERMISSIONS = 0o644
  147.  
  148.  
  149. #############
  150. # DATABASES #
  151. #############
  152.  
  153. DATABASES = {
  154.     "default": {
  155.         # Add "postgresql_psycopg2", "mysql", "sqlite3" or "oracle".
  156.         "ENGINE": "django.db.backends.postgresql_psycopg2",
  157.         # DB name or path to database file if using sqlite3.
  158.         "NAME": "daskretreats_org",
  159.         # Not used with sqlite3.
  160.         "USER": "dask",
  161.         # Not used with sqlite3.
  162.         "PASSWORD": POSTGRES_KEY,
  163.         # Set to empty string for localhost. Not used with sqlite3.
  164.         "HOST": "",
  165.         # Set to empty string for default. Not used with sqlite3.
  166.         "PORT": "",
  167.     }
  168. }
  169.  
  170.  
  171. #########
  172. # PATHS #
  173. #########
  174.  
  175. # Full filesystem path to the project.
  176. PROJECT_APP_PATH = os.path.dirname(os.path.abspath(__file__))
  177. PROJECT_APP = os.path.basename(PROJECT_APP_PATH)
  178. PROJECT_ROOT = BASE_DIR = os.path.dirname(PROJECT_APP_PATH)
  179.  
  180. # Every cache key will get prefixed with this value - here we set it to
  181. # the name of the directory the project is in to try and use something
  182. # project specific.
  183. CACHE_MIDDLEWARE_KEY_PREFIX = PROJECT_APP
  184.  
  185. # URL prefix for static files.
  186. # Example: "http://media.lawrence.com/static/"
  187. STATIC_URL = "/static/"
  188.  
  189. # Absolute path to the directory static files should be collected to.
  190. # Don't put anything in this directory yourself; store your static files
  191. # in apps' "static/" subdirectories and in STATICFILES_DIRS.
  192. # Example: "/home/media/media.lawrence.com/static/"
  193. STATIC_ROOT = os.path.join("/home/dask/www/html/static")
  194.  
  195. # URL that handles the media served from MEDIA_ROOT. Make sure to use a
  196. # trailing slash.
  197. # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
  198. MEDIA_URL = STATIC_URL + "/media/"
  199.  
  200. # Absolute filesystem path to the directory that will hold user-uploaded files.
  201. # Example: "/home/media/media.lawrence.com/media/"
  202. MEDIA_ROOT = os.path.join("/home/dask/www/html/media")
  203.  
  204. # Package/module name to import the root urlpatterns from for the project.
  205. ROOT_URLCONF = "%s.urls" % PROJECT_APP
  206.  
  207. TEMPLATES = [
  208.     {
  209.         "BACKEND": "django.template.backends.django.DjangoTemplates",
  210.         "DIRS": [
  211.             os.path.join(PROJECT_ROOT, "templates")
  212.         ],
  213.         "APP_DIRS": True,
  214.         "OPTIONS": {
  215.             "context_processors": [
  216.                 "django.contrib.auth.context_processors.auth",
  217.                 "django.contrib.messages.context_processors.messages",
  218.                 "django.template.context_processors.debug",
  219.                 "django.template.context_processors.i18n",
  220.                 "django.template.context_processors.static",
  221.                 "django.template.context_processors.media",
  222.                 "django.template.context_processors.request",
  223.                 "django.template.context_processors.tz",
  224.                 "mezzanine.conf.context_processors.settings",
  225.                 "mezzanine.pages.context_processors.page",
  226.             ],
  227.             "builtins": [
  228.                 "mezzanine.template.loader_tags",
  229.             ],
  230.         },
  231.     },
  232. ]
  233.  
  234. if DJANGO_VERSION < (1, 9):
  235.     del TEMPLATES[0]["OPTIONS"]["builtins"]
  236.  
  237.  
  238. ################
  239. # APPLICATIONS #
  240. ################
  241.  
  242. INSTALLED_APPS = (
  243.     "django.contrib.admin",
  244.     "django.contrib.auth",
  245.     "django.contrib.contenttypes",
  246.     "django.contrib.redirects",
  247.     "django.contrib.sessions",
  248.     "django.contrib.sites",
  249.     "django.contrib.sitemaps",
  250.     "django.contrib.staticfiles",
  251.     "mezzanine.boot",
  252.     "mezzanine.conf",
  253.     "mezzanine.core",
  254.     "mezzanine.generic",
  255.     "mezzanine.pages",
  256.     "mezzanine.blog",
  257.     "mezzanine.forms",
  258.     "mezzanine.galleries",
  259.     "mezzanine.twitter",
  260.     # "mezzanine.accounts",
  261.     # "mezzanine.mobile",
  262. )
  263.  
  264. # List of middleware classes to use. Order is important; in the request phase,
  265. # these middleware classes will be applied in the order given, and in the
  266. # response phase the middleware will be applied in reverse order.
  267. MIDDLEWARE_CLASSES = (
  268.     "mezzanine.core.middleware.UpdateCacheMiddleware",
  269.  
  270.     'django.contrib.sessions.middleware.SessionMiddleware',
  271.     # Uncomment if using internationalisation or localisation
  272.     # 'django.middleware.locale.LocaleMiddleware',
  273.     'django.middleware.common.CommonMiddleware',
  274.     'django.middleware.csrf.CsrfViewMiddleware',
  275.     'django.contrib.auth.middleware.AuthenticationMiddleware',
  276.     'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
  277.     'django.contrib.messages.middleware.MessageMiddleware',
  278.     'django.middleware.clickjacking.XFrameOptionsMiddleware',
  279.  
  280.     "mezzanine.core.request.CurrentRequestMiddleware",
  281.     "mezzanine.core.middleware.RedirectFallbackMiddleware",
  282.     "mezzanine.core.middleware.TemplateForDeviceMiddleware",
  283.     "mezzanine.core.middleware.TemplateForHostMiddleware",
  284.     "mezzanine.core.middleware.AdminLoginInterfaceSelectorMiddleware",
  285.     "mezzanine.core.middleware.SitePermissionMiddleware",
  286.     "mezzanine.pages.middleware.PageMiddleware",
  287.     "mezzanine.core.middleware.FetchFromCacheMiddleware",
  288. )
  289.  
  290. # Store these package names here as they may change in the future since
  291. # at the moment we are using custom forks of them.
  292. PACKAGE_NAME_FILEBROWSER = "filebrowser_safe"
  293. PACKAGE_NAME_GRAPPELLI = "grappelli_safe"
  294.  
  295. #########################
  296. # OPTIONAL APPLICATIONS #
  297. #########################
  298.  
  299. # These will be added to ``INSTALLED_APPS``, only if available.
  300. OPTIONAL_APPS = (
  301.     "debug_toolbar",
  302.     "django_extensions",
  303.     "compressor",
  304.     PACKAGE_NAME_FILEBROWSER,
  305.     PACKAGE_NAME_GRAPPELLI,
  306. )
  307.  
  308. ##################
  309. # LOCAL SETTINGS #
  310. ##################
  311.  
  312. # Allow any settings to be defined in local_settings.py which should be
  313. # ignored in your version control system allowing for settings to be
  314. # defined per machine.
  315.  
  316. # Instead of doing "from .local_settings import *", we use exec so that
  317. # local_settings has full access to everything defined in this module.
  318. # Also force into sys.modules so it's visible to Django's autoreload.
  319.  
  320. #f = os.path.join(PROJECT_APP_PATH, "local_settings.py")
  321. #if os.path.exists(f):
  322. #    import sys
  323. #    import imp
  324. #    module_name = "%s.local_settings" % PROJECT_APP
  325. #    module = imp.new_module(module_name)
  326. #    module.__file__ = f
  327. #    sys.modules[module_name] = module
  328. #    exec(open(f, "rb").read())
  329.  
  330.  
  331. ####################
  332. # DYNAMIC SETTINGS #
  333. ####################
  334.  
  335. # set_dynamic_settings() will rewrite globals based on what has been
  336. # defined so far, in order to provide some better defaults where
  337. # applicable. We also allow this settings module to be imported
  338. # without Mezzanine installed, as the case may be when using the
  339. # fabfile, where setting the dynamic settings below isn't strictly
  340. # required.
  341. try:
  342.     from mezzanine.utils.conf import set_dynamic_settings
  343. except ImportError:
  344.     pass
  345. else:
  346.     set_dynamic_settings(globals())
  347.  
  348. root@dask:/home/dask/www/code/daskretreats_org# cat wsgi.py
  349. """
  350. WSGI config for daskretreats_org project.
  351.  
  352. It exposes the WSGI callable as a module-level variable named ``application``.
  353.  
  354. For more information on this file, see
  355. https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
  356. """
  357.  
  358. import os
  359.  
  360. from django.core.wsgi import get_wsgi_application
  361. from mezzanine.utils.conf import real_project_name
  362.  
  363. os.environ.setdefault("DJANGO_SETTINGS_MODULE",
  364.                       "%s.settings" % real_project_name("daskretreats_org"))
  365.  
  366. application = get_wsgi_application()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement