diff --git a/README_eHa.rst b/README_eHa.rst new file mode 100644 index 000000000..bba8703f8 --- /dev/null +++ b/README_eHa.rst @@ -0,0 +1,29 @@ +### NGINX and uWSGI + +follow the guidelines in https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/uwsgi/ +and https://uwsgi.readthedocs.org/en/latest/tutorials/Django_and_nginx.html + +alter the settings in formhub/preset/production.py to the actual location of your production MEDIA and STATIC roots +alter formhub/nginx.conf to match + sudo ln -s /opt/formhub/formhub/nginx.conf /etc/nginx/sites-enabled/ + +uWSGI django.ini file + sudo ln -s /opt/formhub/formhub/wsgi.ini /etc/uwsgi/vassals/ + +test using: + sudo uwsgi --emperor /etc/uwsgi/vassals --uid www-data --gid www-data + +create the file /etc/init/uwsgi.conf containing: + # Emperor uWSGI script + + description "uWSGI Emperor" + start on runlevel [2345] + stop on runlevel [06] + + exec uwsgi --master --die-on-term --emperor /etc/uwsgi/vassals --uid www-data --gid www-data +start it using + sudo start uwsgi + +install your static files into the directory from which they will be served in production + ./manage.py collectstatic + diff --git a/formhub/preset/ehealth_production.py b/formhub/preset/ehealth_production.py index ef2ad49af..b0c44a14b 100644 --- a/formhub/preset/ehealth_production.py +++ b/formhub/preset/ehealth_production.py @@ -1,6 +1,12 @@ # this system uses structured settings.py as defined in http://www.slideshare.net/jacobian/the-best-and-worst-of-django -from formhub.settings import * +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 DEBUG = False # this setting file will not work on "runserver" -- it needs a server for static files diff --git a/odk_logger/views.py b/odk_logger/views.py index a197a6ac4..56430d0f7 100644 --- a/odk_logger/views.py +++ b/odk_logger/views.py @@ -246,7 +246,7 @@ def submission(request, username=None): return OpenRosaResponseBadRequest(_(u"Username or ID required.")) except IsNotCrowdformError: return OpenRosaResponseNotAllowed( - _(u"Sorry but the crowd form you submitted to is closed.") + _(u"Sorry but the form you submitted is not a crowd form.") ) except InstanceEmptyError: return OpenRosaResponseBadRequest(