forked from OpenHumans/django-open-humans
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request OpenHumans#2 from madprime/master
Switch yaml/env to db-based configuration
- Loading branch information
Showing
35 changed files
with
605 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,23 @@ | ||
DATABASE_URL=postgres:///myurl | ||
################################ | ||
# # | ||
# THIS IS A SECRET FILE!!! # | ||
# # | ||
# Do not add your .env to git! # | ||
# # | ||
################################ | ||
|
||
# SECRET_KEY encrypts things. In production it should be a random string. | ||
SECRET_KEY=mysecretshouldnotbeongit | ||
OH_CLIENT_ID=myclientidshouldnotbeongit | ||
OH_CLIENT_SECRET=myclientsecretshouldnotbeongit | ||
|
||
# ADMIN_PASSWORD is how you log in to manage this app and configuration. | ||
ADMIN_PASSWORD='' | ||
|
||
# Optional, but you probably want this for logging and debugging. | ||
PYTHONUNBUFFERED='true' | ||
|
||
# Set DATABASE_URL to use something other than the default SQLite. | ||
# DATABASE_URL=postgres:///myurl | ||
|
||
# Set app base URL. If unset, defaults to http://127.0.0.1:5000 local, | ||
# and herokuapp.com URL on Heroku. | ||
# APP_BASE_URL='http://127.0.0.1:5000' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
release: python manage.py migrate | ||
web: gunicorn oh_data_uploader.wsgi --log-file=- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
# What does my project do? | ||
This tool allows you to easily setup your own *Open Humans* project that wants | ||
to collect data. You just need to set up some configuration files before you | ||
can deploy it *heroku*. | ||
to collect data. | ||
|
||
The configuration files are: | ||
The configuration for this project is in: | ||
|
||
- `config.yaml` in the main directory of this git repository. This contains details | ||
on your project that aren't secret like the title, description, where the logo can be found etc. | ||
- The `.env` contains the secret details that shouldn't be shared. E.g. your database setup, | ||
your *Open Humans* API keys etc. | ||
- The texts that should be displayed on this project website. In `_descriptions` you can find the | ||
markdown files needed to customize this template. E.g. this page is written in `_descriptions/index.md`. | ||
- **Environment variables:** If you deploy to Heroku, you'll probably be | ||
prompted to provide these, and they can be modified in the the app. Locally, | ||
your `.env` file defines these. These are secret details that should not be | ||
shared. (Be sure not to add this to your git repository!) | ||
- **Project configuration:** The [Project Admin page](/project-admin) can be | ||
used to configure other aspects of your site. Log in with the `ADMIN_PASSWORD` | ||
you set in environment variables. | ||
|
||
Use this page to inform your users about what your project is about and what it tries to do. It's the first | ||
page they will see, so be verbose! | ||
As you configure the project, replace this "front page" text to inform | ||
users what your project is about and what it tries to do. It's the first page | ||
they will see, so be verbose! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "Open Humans Data Uploader", | ||
"description": "A web app to support data uploads to an Open Humans project", | ||
"repository": "https://github.com/madprime/oh_data_uploader", | ||
"keywords": ["django"], | ||
"scripts": { | ||
"postdeploy": "python manage.py init_proj_config" | ||
}, | ||
"env": { | ||
"HEROKUCONFIG_APP_NAME": { | ||
"description": "Heroku \"App name\" (copy/paste what you set above)", | ||
"required": true | ||
}, | ||
"ADMIN_PASSWORD": { | ||
"description": "You'll use this password to manage configuring this app.", | ||
"required": true | ||
}, | ||
"SECRET_KEY": { | ||
"description": "This is set for you and is used to encrypt data.", | ||
"generator": "secret" | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
from django.conf import settings | ||
from project_admin.models import ProjectConfiguration | ||
|
||
|
||
def read_config(request): | ||
context = {'yaml_config': settings.YAML_CONFIG, | ||
'oh_proj_page': settings.YAML_CONFIG['oh_activity_page']} | ||
config = ProjectConfiguration.objects.get(id=1) | ||
context = {'config': config, | ||
'is_admin': request.user.username == 'admin', | ||
'oh_proj_page': config.oh_activity_page} | ||
return context |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.