...
 
Commits (2)
.git*
*~
.env
*.sqlite3
*.pyc
*/media
*/static*
__pycache__
......@@ -102,3 +102,6 @@ test_migrations/
# IOS files
.DS_Store
# Static files
static*
\ No newline at end of file
#FROM evili/django:latest
FROM gitlab.iiia.csic.es:5005/evili/docker-django:v1.0.0
COPY . /app
web:env DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE:-birding.settings} gunicorn --bind 0.0.0.0:5000 birding.wsgi
......@@ -13,7 +13,9 @@ https://docs.djangoproject.com/en/2.2/ref/settings/
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(
os.path.abspath(__file__)
)))
# Quick-start development settings - unsuitable for production
......@@ -120,17 +122,4 @@ USE_TZ = True
# https://docs.djangoproject.com/en/2.2/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
#
# Herokuish
#
import django_heroku
django_heroku.settings(locals())
# REMOVE SSL FOR TESTING
if DEBUG:
try:
DATABASES['default']['OPTIONS']['sslmode'] = 'prefer'
except Exception:
pass
STATIC_ROOT = os.path.join(BASE_DIR, 'static-files')
#
# Django Settings Module entirely based on defaults and environment
# First we import the default settings for the project that
# should reside in <projectname>.settings
# then we import the global_settings from django.conf
# superseeded by the default <projectname>.settings
# For each setting SETTING_NAME test if the corresponding
# environment variable DJANGO_SETTING_NAME is defined.
# If it is, we incorporate as a true Django Setting
# By default, we check if the global or default setting is a string,
# if not we evaluate directly the value as a Python expression.
#
# Special Cases:
# If DJANGO_DATABASES is not defined we look for alternate definition
# via DJANGO_DATABASE_ENGINE, DJANGO_DATABASE_HOST, DJANGO_DATABASE_NAME,
# DJANGO_DATABASE_USER, and DJANGO_DATABASE_PASSWORD; defaulting to postgres
# environment variables POSTGRES_HOST, POSTGRES_DB, etc.
#
import os
from django.conf import global_settings as __global_settings
from .. import settings as __default_settings
#
# Default project settings
#
from . import *
#
# Dictionary to hold global and default settings
#
__settings = {}
# Django global settings dict
__settings.update(vars(__global_settings))
# default settings as a dict
__settings.update(vars(__default_settings))
for st,val in __settings.items():
# skip private items
if st.startswith('_'):
continue
else:
# look for the corresponding 'DJANGO_..' environment
env_setting = os.getenv('DJANGO_'+st, None)
if env_setting is not None:
# if the former setting was a string evaluate as such
if isinstance(val, str):
exec(st+" = '"+env_setting+"'")
else:
exec(st+" = "+env_setting)
if os.getenv('DJANGO_DATABASES', None) is None:
_PROJECT_NAME = os.getenv('DJANGO_SETTINGS_MODULE').split('.')[0]
DATABASES = {
'default': {
'ENGINE': os.getenv('DJANGO_DATABASE_ENGINE','django.db.backends.postgresql'),
'HOST': os.getenv('DJANGO_DATABASE_HOST', os.getenv('POSTGRES_HOST', 'postgres')),
'NAME': os.getenv('DJANGO_DATABASE_NAME', os.getenv('POSTGRES_DB', _PROJECT_NAME)),
'USER': os.getenv('DJANGO_DATABASE_USER', os.getenv('POSTGRES_USER', _PROJECT_NAME)),
'PASSWORD' : os.getenv('DJANGO_DATABASE_PASSWORD', os.getenv('POSTGRES_PASSWORD', _PROJECT_NAME)),
}
}
import os
from django.conf import global_settings
from .environ import *
DEBUG = False
ALLOWED_HOSTS = os.getenv('DJANGO_ALLOWED_HOSTS', '["*"]')