Skip to content

Commit

Permalink
Merge pull request #87 from rloomans/one-click-deploy
Browse files Browse the repository at this point in the history
One click deploy
  • Loading branch information
rloomans committed Mar 26, 2019
2 parents 881a3b9 + c628cdf commit 04779e0
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 19 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,22 @@ same browser.
The results page are available to the creator using the same cookie mechanism,
and also a password in case the cookie is lost.


Heroku One-click Deploy
-----------------------

[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)

After you successfully deploy your app to Heroku, make sure that you add the following to the Heroku Scheduler as a daily job:

```
python bin/archive_scores.py
```

Also, if you want to access the Django admin site, add a super user using the heroku CLI:

```
heroku run --app <Your Heroku app name here> python manage.py createsuperuser --username <admin user> --email <admin email address>
```

and then go to https://\<Your Heroku app name here>.herokuapp.com/djadmin/
21 changes: 18 additions & 3 deletions app.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,49 @@
{
"name": "new-teamtemp",
"description": "Survey and summarise team happiness",
"repository": "https://github.com/rloomans/new-teamtemp",
"website": "https://github.com/rloomans/new-teamtemp",
"logo": "https://raw.githubusercontent.com/rloomans/new-teamtemp/master/teamtemp/static/favicon.ico",
"keywords": ["team", "django", "metrics"],
"scripts": {
},
"env": {
"DJANGO_DEBUG": {
"description": "Whether debuging should be on for Django. WARNING: should be turned off for production sites.",
"value": "True"
},
"DJANGO_SETTINGS_MODULE": {
"value": "teamtemp.settings.secure",
"required": true
},
"TEAM_TEMP_CRON_PIN": {
"required": false
"description": "Secret PIN for accessing the cron URL",
"required": true,
"generator": "secret"
},
"TEAM_TEMP_CRON_URL": {
"description": "The URL to initiate the CRON task",
"value": "https://<Your Heroku app name here>.herokuapp.com/cron/",
"required": false
},
"TEAMTEMP_SECRET_KEY": {
"description": "A secret key for verifying the integrity of signed cookies.",
"generator": "secret"
},
"XMASHAPEKEY": {
"required": true
"description": "A secret key for the word cloud generation service",
"required": false
},
"GOOGLE_ANALYTICS_PROPERTY_ID": {
"description": "The unique id for this site in your Google Analytics account",
"required": false
}
},
"formation": {
},
"addons": [
"heroku-postgresql"
"heroku-postgresql",
"scheduler"
],
"buildpacks": [
{
Expand Down
4 changes: 2 additions & 2 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
-r base.txt

factory_boy>=2.8.1
coverage>=4.3.1
db-sqlite3>=0.0.1
django-extensions>=1.7.3
factory_boy>=2.11.1
factory_djoy>=2.1.0
pydot>=1.2.2
factory_djoy>=0.6.0
7 changes: 3 additions & 4 deletions teamtemp/tests/models/test_team_temperature.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from builtins import str
import re
from django.forms import ValidationError
from django.test import TestCase

from teamtemp.tests.factories import TeamTemperatureFactory, UserFactory
Expand Down Expand Up @@ -43,12 +42,12 @@ def test_multiple_surveys_for_user(self):
self.assertEqual(user.team_temperatures.count(), 2)

def test_duplicate_teamtemp_ids(self):
with self.assertRaises(ValidationError):
with self.assertRaises(RuntimeError):
TeamTemperatureFactory(id='bob')
TeamTemperatureFactory(id='bob')

def test_invalid_max_word_count(self):
with self.assertRaises(ValidationError):
with self.assertRaises(RuntimeError):
TeamTemperatureFactory(max_word_count=0)
with self.assertRaises(ValidationError):
with self.assertRaises(RuntimeError):
TeamTemperatureFactory(max_word_count=11)
3 changes: 1 addition & 2 deletions teamtemp/tests/models/test_teams.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from builtins import str
from django.forms import ValidationError
from django.test import TestCase

from teamtemp.tests.factories import TeamTemperatureFactory, TeamFactory
Expand Down Expand Up @@ -32,7 +31,7 @@ def test_multiple_surveys_for_user(self):

def test_duplicate_team_names(self):
teamtemp = TeamTemperatureFactory()
with self.assertRaises(ValidationError):
with self.assertRaises(RuntimeError):
TeamFactory(team_name='bob', request=teamtemp)
TeamFactory(team_name='bob', request=teamtemp)

Expand Down
10 changes: 5 additions & 5 deletions teamtemp/tests/models/test_temperature_response.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from __future__ import division
from builtins import str
from past.utils import old_div

import itertools
from builtins import str

from django.test import TestCase
from django.core.exceptions import ValidationError
from past.utils import old_div

from teamtemp.tests.factories import TeamTemperatureFactory, TemperatureResponseFactory, UserFactory

Expand Down Expand Up @@ -78,7 +78,7 @@ def test_pretty_team_name(self):
self.assertEqual(response.pretty_team_name(), 'bob and his friends')

def test_invalid_score(self):
with self.assertRaises(ValidationError):
with self.assertRaises(RuntimeError):
TemperatureResponseFactory(score=0)
with self.assertRaises(ValidationError):
with self.assertRaises(RuntimeError):
TemperatureResponseFactory(score=11)
3 changes: 1 addition & 2 deletions teamtemp/tests/models/test_users.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from builtins import str
from django.forms import ValidationError
from django.test import TestCase

from teamtemp.tests.factories import UserFactory
Expand All @@ -16,6 +15,6 @@ def test_uniq_user_ids(self):
self.assertNotEqual(UserFactory().id, UserFactory().id)

def test_duplicate_user_ids(self):
with self.assertRaises(ValidationError):
with self.assertRaises(RuntimeError):
UserFactory(id='bob')
UserFactory(id='bob')
2 changes: 1 addition & 1 deletion teamtemp/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
name='bvc'),

re_path(r'^reset/(?P<survey_id>[0-9a-zA-Z]{8})/?$', reset_view, name='reset'),
re_path(r'^cron/(?P<pin>[0-9]{4,16})$', cron_view, name='cron'),
re_path(r'^cron/(?P<pin>.{4,100})$', cron_view, name='cron'),
re_path(r'^team/(?P<survey_id>[0-9a-zA-Z]{8})/(?P<team_name>[-\w]{1,64})$', team_view, name='team'),
re_path(r'^team/(?P<survey_id>[0-9a-zA-Z]{8})/?$', team_view, name='team'),
re_path(r'^wordcloud/(?P<word_hash>[a-f0-9]{40})?$', wordcloud_view, name='wordcloud'),
Expand Down

0 comments on commit 04779e0

Please sign in to comment.