Skip to content

Commit

Permalink
corrections to config for production
Browse files Browse the repository at this point in the history
  • Loading branch information
vernondcole committed Apr 13, 2014
1 parent c84f8af commit 8b7d632
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 30 deletions.
2 changes: 1 addition & 1 deletion formhub/formhub_nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# the upstream component nginx needs to connect to
upstream django {
server unix:///opt/formhub/formhub.sock ; # for a file socket
server unix:///tmp/formhub.sock;
#server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}

Expand Down
73 changes: 45 additions & 28 deletions formhub/preset/production.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,38 @@
# this system uses structured settings.py as defined in http://www.slideshare.net/jacobian/the-best-and-worst-of-django

try:
from ..settings import *
except ImportError:
import sys, django
django.utils.six.reraise(RuntimeError, *sys.exc_info()[1:]) # use RuntimeError to extend the traceback
except:
raise
from formhub.settings import *

DEBUG = False # this setting file will not work on "runserver" -- it needs a server for static files

ADMINS = (
('Adam', '[email protected]'),
)

MANAGERS = ADMINS

# override to set the actual location for the production static and media directories
MEDIA_ROOT = '/var/formhub-media'
STATIC_ROOT = "/srv/formhub-static"
STATICFILES_DIRS = (
os.path.join(PROJECT_ROOT, "static"),
)
ADMINS = (
# ('Your Name', '[email protected]'),
)

# your actual production settings go here...,.
# for 12-factor installations, this will be in a URL read by default_settings.py
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.postgresql_psycopg2',
# 'NAME': 'formhub',
# 'USER': 'formhub_prod',
# 'PASSWORD': os.environ['FORMHUB_PROD_PW'], # the password must be stored in an environment variable
# 'HOST': os.environ.get("FORMHUB_DB_SERVER", 'dbserver.yourdomain.org'), # the server name may be in env
# 'OPTIONS': {
# 'autocommit': True, # note: this option obsolete starting with django 1.6
# }
# },
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'phis',
'USER': 'phis',
'PASSWORD': 'nopolio4u', # os.environ['PHIS_PW'], # the password must be stored in an environment variable
'HOST': 'nomads.eocng.org',
'OPTIONS': {
'autocommit': True,
}
}
}

#
ALLOWED_HOSTS = ['formhub.eocng.org', 'forms.ehealthafrica.org',
'forms.ehealth.org.ng']

#DATABASE_ROUTERS = ['formhub.preset.dbrouter.GisRouter']

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
Expand All @@ -40,8 +41,19 @@
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/New_York'
#TIME_ZONE = 'Africa/Lagos'
TIME_ZONE = 'Africa/Lagos'

BROKER_URL = 'amqp://formhub:12345678@localhost:5672/formhub_vhost'

EMAIL_HOST = 'smtp.gmail.com' #The host to use for sending email.

EMAIL_HOST_PASSWORD = "donotreply12345" #os.environ.get("FORMHUB_EMAIL_PASSWORD", "12345678")
#Password to use for the SMTP server defined in EMAIL_HOST.
EMAIL_HOST_USER = '[email protected]'

EMAIL_PORT = 587
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = "[email protected]"

TOUCHFORMS_URL = 'http://localhost:9000/'

Expand All @@ -53,4 +65,9 @@
'PASSWORD': ''
}
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'mlfs33^s1l4xf6a36$0#j%dd*sisfo6HOk3245u3tYXB9y'
SECRET_KEY = 'mlfs33^s1l4xf6a36$0#j%dd*sisfo6HOktYXB9y'

TESTING_MODE = False

ENKETO_URL = 'https://enketo.org/'
ENKETO_API_TOKEN = 'mo4ao9nrr5a2x1or'
2 changes: 1 addition & 1 deletion uwsgi_formhub.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ virtualenv = /opt/virtual_environments/formhub

#vacuum = true

env = DJANGO_SETTINGS_MODULE=formhub.preset.staging
env = DJANGO_SETTINGS_MODULE=formhub.preset.production
log-date = %%Y-%%m-%%dt%%H:%%M:%%S
logto = /var/log/uwsgi/uwsgi_formhub.log

0 comments on commit 8b7d632

Please sign in to comment.