close
Skip to content

Commit de1d11a

Browse files
author
Michael Nelson
committed
Add a basic settings with configurable django secret key.
1 parent df70e58 commit de1d11a

4 files changed

Lines changed: 59 additions & 160 deletions

File tree

‎config.yaml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,13 @@ options:
1010
current_symlink:
1111
default: "latest"
1212
type: string
13-
description: |
13+
description: >
1414
The symlink of the code to run. The default of 'latest' will use
1515
the most recently added build on the instance. Specifying a
1616
differnt label (eg. "r235") will symlink to that directory assuming
1717
it has been previously added to the instance.
18+
django_secret_key:
19+
default: "you-really-should-set-this"
20+
type: string
21+
description: >
22+
The secret key that django should use for each instance.

‎django-project/clickreviewsproject/settings.py‎

Lines changed: 0 additions & 158 deletions
This file was deleted.

‎playbook.yml‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,25 @@
2929
- install
3030
- upgrade-charm
3131

32-
- name: Write any custom configuration files
32+
- name: Copy the project configuration
3333
copy: src=django-project dest={{ application_dir }} owner={{ wsgi_user }} group={{ wsgi_group }}
3434
tags:
3535
- install
3636
- upgrade-charm
3737
notify:
3838
- Restart wsgi
3939

40+
- name: Write the settings
41+
template:
42+
src: "templates/settings.py.j2"
43+
dest: "{{ application_dir }}/django-project/clickreviewsproject/settings.py"
44+
owner: "{{ wsgi_user }}"
45+
group: "{{ wsgi_group }}"
46+
tags:
47+
- install
48+
- upgrade-charm
49+
notify:
50+
- Restart wsgi
4051
# XXX Normally our deployment build would ensure these are all available in the tarball.
4152
- name: Install any non-distro dependencies (Don't depend on pip for a real deployment!)
4253
pip: name={{ item.key }} version={{ item.value }}

‎templates/settings.py.j2‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
DEBUG = True
2+
TEMPLATE_DEBUG = DEBUG
3+
SECRET_KEY = '{{ django_secret_key }}'
4+
TIME_ZONE = 'UTC'
5+
ROOT_URLCONF = 'clickreviewsproject.urls'
6+
WSGI_APPLICATION = 'clickreviewsproject.wsgi.application'
7+
INSTALLED_APPS = (
8+
'django.contrib.auth',
9+
'django.contrib.contenttypes',
10+
'django.contrib.sessions',
11+
'django.contrib.sites',
12+
'django_openid_auth',
13+
'django.contrib.messages',
14+
'django.contrib.staticfiles',
15+
'clickreviews',
16+
'south',
17+
)
18+
AUTHENTICATION_BACKENDS = (
19+
'django_openid_auth.auth.OpenIDBackend',
20+
'django.contrib.auth.backends.ModelBackend',
21+
)
22+
LOGIN_URL = '/openid/login/'
23+
LOGIN_REDIRECT_URL = '/'
24+
OPENID_CREATE_USERS = True
25+
OPENID_REUSE_USERS = True
26+
OPENID_UPDATE_DETAILS_FROM_SREG = True
27+
OPENID_SSO_SERVER_URL = 'https://login.staging.ubuntu.com/'
28+
OPENID_LAUNCHPAD_TEAMS_MAPPING = {
29+
'rnr-moderators': 'rnr-moderators',
30+
}
31+
# Reviews settings
32+
MODERATORS_GROUP = 'rnr-moderators'
33+
API_REVIEWS_PAGINATION = 10
34+
PRELOAD_API_SERVICE_ROOTS = False
35+
CACHE_REVIEW_STATS_SECONDS = 60*60*4
36+
TOKEN_CACHE_EXPIRY_HOURS = 4
37+
REVIEWSAPP_MEDIA_ROOT = 'src/reviewsapp/media'
38+
ENABLE_ARTIFICIAL_OOPS = True
39+
MODIFY_WINDOW_MINUTES = 120
40+
41+
OAUTH_DATA_STORE = 'reviewsapp.models.oauthtoken.DataStore'

0 commit comments

Comments
 (0)