From 000d63d49b93159eab8c30c56b8ed577a79e7d14 Mon Sep 17 00:00:00 2001 From: Tyler Hallada Date: Mon, 28 Jul 2014 18:53:30 -0400 Subject: [PATCH] Update to allow running on Heroku --- Procfile | 1 + README.md | 22 ++++++++++++++++++++++ laundry/wsgi.py | 4 +++- requirements.txt | 14 ++++++++++++++ 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 Procfile create mode 100644 requirements.txt diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..cfa2deb --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: gunicorn laundry.wsgi --log-file - diff --git a/README.md b/README.md index 755d3f3..c6bf6ed 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,13 @@ decided to make this it's own website. * DATABASE_HOST * Modify the `ADMINS` variable in `settings.py` so you get emails when the site errors (happens when eSuds changes something on their site). +* Create and activate a virtualenv: `virtualenv venv` and + `source venv/bin/activate` +* Install the requirements: `pip install -r requirements.txt` * Run syncdb: `python manage.py syncdb` * Import the GMU Laundry Hall data: `python manage.py loaddata laundry.json` * Run the server: `python manage.py runserver` +* Don't forget to set `DEBUG` to `False` when you are production ready. ##Errors## @@ -48,6 +52,24 @@ Sometimes errors happen when eSuds goes down too. Nothing we can really do about that, but perhaps we can improve our downtime by caching previous results and showing those in the intrim. +##Backups## + +It would be a good idea to periodically dump the database because, right now, +there isn't an automated way of creating the Halls and LaundryMachines. To [save +the +database](https://docs.djangoproject.com/en/dev/ref/django-admin/#dumpdata-app-label-app-label-app-label-model) +run: + +`python manage.py dumpdata laundry_app > laundry_backup.json` + +You can load a backup with: + +`python manage.py loaddata laundry_backup.json` + +It would be nice of you to keep the `laundry.json` file in this repo up-to-date +as halls' laundry machine configurations change so that anyone setting up this +application will not have errors upon starting up. + ##Todo## Move away from Django to Javascript. There's no real reason to have a backend diff --git a/laundry/wsgi.py b/laundry/wsgi.py index de70502..fa809a0 100644 --- a/laundry/wsgi.py +++ b/laundry/wsgi.py @@ -25,7 +25,9 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "laundry.settings") # file. This includes Django's development server, if the WSGI_APPLICATION # setting points here. from django.core.wsgi import get_wsgi_application -application = get_wsgi_application() +from dj_static import Cling + +application = Cling(get_wsgi_application()) # Apply WSGI middleware here. # from helloworld.wsgi import HelloWorldApplication diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..bcb1c5e --- /dev/null +++ b/requirements.txt @@ -0,0 +1,14 @@ +BeautifulSoup==3.2.1 +Django==1.6.5 +MySQL-python==1.2.5 +South==1.0 +argparse==1.2.1 +dj-database-url==0.3.0 +dj-static==0.0.6 +django-toolbelt==0.0.1 +gunicorn==19.1.0 +lxml==3.3.5 +psycopg2==2.5.3 +pygal==1.4.6 +static3==0.5.1 +wsgiref==0.1.2