-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from tumb1er/unite_defaults_implementation
Unite defaults ans default_settings after #22
- Loading branch information
Showing
3 changed files
with
40 additions
and
57 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,39 @@ | ||
from os import getenv as e | ||
from os import getenv | ||
|
||
from django.conf import settings | ||
|
||
|
||
def e(name, default): | ||
""" | ||
Returns settings value from django settings or environment. | ||
:param name: setting name | ||
:param default: default value if setting is not specified in django | ||
settings module and environment. | ||
""" | ||
try: | ||
return getattr(settings, name) | ||
except AttributeError: | ||
return getenv(name, default) | ||
|
||
|
||
# Hostname used in sitemap links | ||
SITEMAP_HOST = e('SITEMAP_HOST', 'localhost') | ||
# Port used in sitemap links | ||
SITEMAP_PORT = e('SITEMAP_PORT', '443') | ||
# Protocol used in sitemap links | ||
SITEMAP_PROTO = e('SITEMAP_PROTO', 'https') | ||
|
||
# Default directory in media storage where sitemaps are stored | ||
SITEMAP_MEDIA_PATH = e('SITEMAP_MEDIA_PATH', 'sitemaps') | ||
|
||
# Default media storage for sitemaps | ||
SITEMAP_STORAGE = e('SITEMAP_STORAGE', | ||
'django.core.files.storage.default_storage') | ||
|
||
# Default name of sitemap index view | ||
SITEMAP_INDEX_NAME = e('SITEMAP_INDEX_NAME', 'sitemap-index') | ||
|
||
# Default name of sitemaps view | ||
SITEMAPS_VIEW_NAME = e('SITEMAPS_VIEW_NAME', | ||
'django.contrib.sitemaps.views.sitemap') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters