Permalink
Browse files

implement heroku config

  • Loading branch information...
graik committed May 7, 2016
1 parent cbb1a82 commit 1e3b07f4420eb2afdca1159d69f2397ea0aff82f
Showing with 245 additions and 199 deletions.
  1. +7 −0 .gitignore
  2. +1 −0 Procfile
  3. +20 −0 app.json
  4. +5 −0 requirements.txt
  5. +0 −1 rotmicsite/settings.py
  6. +202 −0 rotmicsite/settings.py
  7. +0 −191 rotmicsite/settings_dev.py
  8. +10 −7 rotmicsite/wsgi.py
View
@@ -1,3 +1,10 @@
## custom additions
venv
*wpu
*sqlite3
staticfiles
.env
*.py[cod]
# C extensions
View
@@ -0,0 +1 @@
web: gunicorn rotmicsite.wsgi --log-file -
View
@@ -0,0 +1,20 @@
{
"name": "Rotten Microbes Sample Management",
"description": "Django app for management of samples and data sheets in a molecular biology / synthetic biology lab",
"repository": "https://github.com/graik/rotmic.git",
"keywords": ["python", "django", "science"],
"env": {
"DJANGO_SECRET_KEY" : {
"description": "A secret key for https encryption",
"generator": "secret"
}
},
"addons": [ "heroku-postgresql" ],
"scripts": {
"postdeploy" : "./manage.py migrate --noinput; python manage.py loaddata initial_data.json"
},
"buildpacks": [
{"url": "heroku/python"},
{"url": "https://github.com/andreipetre/heroku-buildpack-django-migrate"}
]
}
View
@@ -9,3 +9,8 @@ numpy==1.11.0
pytz==2016.4
South==1.0.2
xlrd==0.9.4
dj-database-url==0.4.0
gunicorn==19.4.5
psycopg2==2.6.1
whitenoise==2.0.6
View

This file was deleted.

Oops, something went wrong.
View
@@ -0,0 +1,202 @@
# Django settings for rotmicsite project.
import os.path as osp
import os
# Build paths inside the project like this: os.path.join(PROJECT_ROOT, ...)
PROJECT_ROOT = osp.dirname(osp.dirname(__file__))
# custom: distinguish development from production server
import sys
RUNNING_DEV_SERVER = ('runserver' in sys.argv)
DEBUG = RUNNING_DEV_SERVER
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
# Database configuration by Heroku $DATABASE_URL
# Use persistent connections
# https://devcenter.heroku.com/articles/django-app-configuration#database-connection-persistence
## this will be overriden by $DATABASE_URL configuration; sqlite is fall-back
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(PROJECT_ROOT, 'db.sqlite3'),
}}
print DATABASES['default']
import dj_database_url
db_from_env = dj_database_url.config(conn_max_age=500)
DATABASES['default'].update(db_from_env)
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ['*']
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/
# https://devcenter.heroku.com/articles/django-app-configuration#static-assets-and-file-serving
# Absolute path to the directory static files should be collected to.
STATIC_ROOT = osp.join(PROJECT_ROOT, 'rotmicsite','staticfiles')
# URL prefix for static files.
STATIC_URL = '/static/'
# Additional locations of static files
## STATICFILES_DIRS = ()
# List of finder classes that know how to find static files in various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
# Simplified static file serving.
# https://warehouse.python.org/project/whitenoise/
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'settings-k^(3w9m#hndetog(ap+f(m+^jn*vu&s4a9cv3%&a(fe)$aq=s'
try:
## prepare env variable:
## heroku config:add DJANGO_SECRET_KEY="your_secret_key"
## Note: () are not tolerated in the key even using quotation marks
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY') or SECRET_KEY
except:
pass
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
TIME_ZONE = 'US/Eastern'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = False
# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True
# site-wide default for displaying dates
DATE_FORMAT = 'Y-m-d'
DATETIME_FORMAT = 'Y-m-d H:i'
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/var/www/example.com/media/"
MEDIA_ROOT = osp.join(PROJECT_ROOT, 'dev_uploads')
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://example.com/media/", "http://media.example.com/"
MEDIA_URL = '/media/'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)
TEMPLATE_CONTEXT_PROCESSORS = ("django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.core.context_processors.tz",
"django.contrib.messages.context_processors.messages",
"django.core.context_processors.request",
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
ROOT_URLCONF = 'rotmicsite.urls'
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'rotmicsite.wsgi.application'
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend', # default
)
ANONYMOUS_USER_ID = -1
AUTH_PROFILE_MODULE = "rotmic.UserProfile"
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
'django_comments',
'ratedcomments',
'south',
'selectable',
'reversion',
'rotmic',
'django.contrib.admin', ## last for lowest priority in template loading
)
COMMENTS_APP = 'ratedcomments'
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
Oops, something went wrong.

0 comments on commit 1e3b07f

Please sign in to comment.