Browse Source

Update to allow running on Heroku

Tyler Hallada 9 years ago
parent
commit
000d63d49b
4 changed files with 40 additions and 1 deletions
  1. 1 0
      Procfile
  2. 22 0
      README.md
  3. 3 1
      laundry/wsgi.py
  4. 14 0
      requirements.txt

+ 1 - 0
Procfile

@@ -0,0 +1 @@
1
+web: gunicorn laundry.wsgi --log-file -

+ 22 - 0
README.md

@@ -18,9 +18,13 @@ decided to make this it's own website.
18 18
   * DATABASE_HOST
19 19
 * Modify the `ADMINS` variable in `settings.py` so you get emails when the site
20 20
   errors (happens when eSuds changes something on their site).
21
+* Create and activate a virtualenv: `virtualenv venv` and
22
+  `source venv/bin/activate`
23
+* Install the requirements: `pip install -r requirements.txt`
21 24
 * Run syncdb: `python manage.py syncdb`
22 25
 * Import the GMU Laundry Hall data: `python manage.py loaddata laundry.json`
23 26
 * Run the server: `python manage.py runserver`
27
+* Don't forget to set `DEBUG` to `False` when you are production ready.
24 28
 
25 29
 ##Errors##
26 30
 
@@ -48,6 +52,24 @@ Sometimes errors happen when eSuds goes down too. Nothing we can really do about
48 52
 that, but perhaps we can improve our downtime by caching previous results and
49 53
 showing those in the intrim.
50 54
 
55
+##Backups##
56
+
57
+It would be a good idea to periodically dump the database because, right now,
58
+there isn't an automated way of creating the Halls and LaundryMachines. To [save
59
+the
60
+database](https://docs.djangoproject.com/en/dev/ref/django-admin/#dumpdata-app-label-app-label-app-label-model)
61
+run:
62
+
63
+`python manage.py dumpdata laundry_app > laundry_backup.json`
64
+
65
+You can load a backup with:
66
+
67
+`python manage.py loaddata laundry_backup.json`
68
+
69
+It would be nice of you to keep the `laundry.json` file in this repo up-to-date
70
+as halls' laundry machine configurations change so that anyone setting up this
71
+application will not have errors upon starting up.
72
+
51 73
 ##Todo##
52 74
 
53 75
 Move away from Django to Javascript. There's no real reason to have a backend

+ 3 - 1
laundry/wsgi.py

@@ -25,7 +25,9 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "laundry.settings")
25 25
 # file. This includes Django's development server, if the WSGI_APPLICATION
26 26
 # setting points here.
27 27
 from django.core.wsgi import get_wsgi_application
28
-application = get_wsgi_application()
28
+from dj_static import Cling
29
+
30
+application = Cling(get_wsgi_application())
29 31
 
30 32
 # Apply WSGI middleware here.
31 33
 # from helloworld.wsgi import HelloWorldApplication

+ 14 - 0
requirements.txt

@@ -0,0 +1,14 @@
1
+BeautifulSoup==3.2.1
2
+Django==1.6.5
3
+MySQL-python==1.2.5
4
+South==1.0
5
+argparse==1.2.1
6
+dj-database-url==0.3.0
7
+dj-static==0.0.6
8
+django-toolbelt==0.0.1
9
+gunicorn==19.1.0
10
+lxml==3.3.5
11
+psycopg2==2.5.3
12
+pygal==1.4.6
13
+static3==0.5.1
14
+wsgiref==0.1.2