From 11e4b14a65133960cefafca52d8aaf6d7b2f4950 Mon Sep 17 00:00:00 2001 From: Mitch Riedstra Date: Tue, 31 Oct 2017 17:12:38 -0400 Subject: Changes to make the app work under uwsgi --- app/app/settings.py | 3 ++- app/config.yml | 13 +++++++++++++ app/requirements.txt | 1 + app/uwsgi.ini | 12 ++++++++++++ app/wsgi.py | 7 +++++++ 5 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 app/uwsgi.ini create mode 100644 app/wsgi.py (limited to 'app') diff --git a/app/app/settings.py b/app/app/settings.py index abf4cbc..d472675 100644 --- a/app/app/settings.py +++ b/app/app/settings.py @@ -28,7 +28,7 @@ SECRET_KEY = 'h$r_bwlp@#h#y#%&qhw-n=gb2%wva1d_h65+o94u&!a#%iv&lo' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = CONFIG['allowed_hosts'] # Application definition @@ -135,6 +135,7 @@ USE_TZ = True # https://docs.djangoproject.com/en/1.11/howto/static-files/ STATIC_URL = '/static/' +STATIC_ROOT = CONFIG['static_root'] LOGIN_URL = '/login/' LOGIN_REDIRECT_URL = '/' diff --git a/app/config.yml b/app/config.yml index a60a66e..80a9d6e 100644 --- a/app/config.yml +++ b/app/config.yml @@ -7,7 +7,20 @@ db_default: PASSWORD: HOST: 127.0.0.1 PORT: 5432 +# MySQL Example +# db_default: +# ENGINE: django.db.backends.mysql +# NAME: dispatch_test +# USER: dispatch +# PASSWORD: ahB2lee5 +# HOST: 127.0.0.1 +# PORT: 3306 # Sqlite example. Full path is recommended # db_default: # ENGINE: django.db.backends.sqlite3 # NAME: /home/mitch/scm/dispatch-tracker/app/db.sqlite3 + +allowed_hosts: + - example.com + +static_root: '/full/path/to/static/root' diff --git a/app/requirements.txt b/app/requirements.txt index b9c0537..54570ed 100644 --- a/app/requirements.txt +++ b/app/requirements.txt @@ -8,3 +8,4 @@ python-dateutil==2.6.1 pytz==2017.2 PyYAML==3.12 six==1.10.0 +mysqlclient==1.3.12 diff --git a/app/uwsgi.ini b/app/uwsgi.ini new file mode 100644 index 0000000..5b7b516 --- /dev/null +++ b/app/uwsgi.ini @@ -0,0 +1,12 @@ +[uwsgi] +processes = 1 +threads = 4 + +socket = 127.0.0.1:9200 + +module = wsgi:application + +daemonize=uwsgi.log +pidfile=uwsgi.pid + +home = env diff --git a/app/wsgi.py b/app/wsgi.py new file mode 100644 index 0000000..5cc801e --- /dev/null +++ b/app/wsgi.py @@ -0,0 +1,7 @@ +import os + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings") + +from django.core.wsgi import get_wsgi_application + +application = get_wsgi_application() -- cgit v1.2.3