Skip to content

Commit 4d7af2c

Browse files
committed
[readme update][s]: README updated with correct instructions. env.template updated to include correct ev variables - fixes #300
1 parent 0edf417 commit 4d7af2c

File tree

2 files changed

+67
-23
lines changed

2 files changed

+67
-23
lines changed

README.md

+55-15
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,68 @@ $ psql -U postgres -c "create user dpr_user password 'secret' createdb;"
3737
$ psql -U postgres -c "create database dpr_db owner=dpr_user;"
3838
3939
# create tables
40-
python manager.py db upgrade
40+
$ python manager.py createdb
41+
$ python manager.py populate
4142
```
4243

44+
While development, if you make changes to database structure, Eg: added new table,
45+
renamed column etc... You will have to **drop** all the tables and recreate them
46+
47+
```
48+
$ python manager.py dropdb
49+
$ python manager.py createdb
50+
$ python manager.py populate
51+
```
52+
53+
Note: Be careful! Doing so **all** of you data will be erased. **Never, ever** run
54+
`python manager.py dropdb` on production database like RDS or any other, unless you
55+
are super confident what are you doing!
56+
4357
### Environment Configuration
4458

4559
Rename the env.template file to .env file and edit it.
4660

47-
TODO: guidance about this including how to use the DB you created in the
48-
previous step.
61+
```
62+
JWT_SEED=<<Super Secret Key For Flask Sessions>>
63+
SQLALCHEMY_DATABASE_URI=<<Postgres Database URI>>*
64+
S3_BUCKET_NAME=<<AWS S3 Bucket Name For Data Storage>>
65+
AWS_ACCESS_KEY_ID= <<AWS Access Key>>
66+
AWS_SECRET_ACCESS_KEY= <<AWS Secret Access Key>>
67+
AWS_REGION= <<AWS Region >>
68+
GITHUB_CLIENT_ID= <<Github Client ID>>
69+
GITHUB_CLIENT_SECRET= <<Github Client Secret>>
70+
71+
# For Deploy
72+
PROJECT= <<Project Name>>
73+
DOMAIN_BASE= <<Domain Base. Eg: example.com>>
74+
STAGE=<<Project Stage. Eg: dev>>
75+
DOMAIN=<<Full Domain. Eg: dev.example.com>>
76+
DPR_API_GIT=<<Git URL For Repo>>
77+
```
78+
79+
For local development you can leave empty all variables except following ones:
80+
81+
- SQLALCHEMY_DATABASE_URI
82+
- JWT_SEED
83+
- AWS_REGION
84+
- GITHUB_CLIENT_ID
85+
- GITHUB_CLIENT_SECRET
86+
87+
You can use any string you like, Eg: "development", for all of them, except `SQLALCHEMY_DATABASE_URI`
88+
89+
SQLALCHEMY_DATABASE_URI should follow the general form for a postgresq connection URI:
90+
`postgres://[user[:password]@][netloc][:port][/dbname][?param1=value1&...]`
91+
92+
If you created postgres database by following our instructions above, it should look like this:
93+
94+
`SQLALCHEMY_DATABASE_URI=postgres://dpr_user:secret@localhost/dpr_db`
4995

5096
### Running locally
5197

5298
You can now run the app locally! To do, run:
5399

54100
```
55-
python dpr.py
101+
$ python dpr.py
56102
```
57103

58104
## Testing
@@ -66,21 +112,15 @@ $ export FLASK_CONFIGURATION=test
66112
This ensures that tests are not dependent on any env variable. By default it is dependent on
67113
local postgresql instance.
68114

69-
TODO: explain how to set up this postgresql instance.
70-
71-
We use pytest for testing. All tests are in tests directory. To run the tests do:
115+
You would want to create separate database for tests, for not loosing all the data
116+
from development database, you are working with.
72117

73118
```
74-
pytest tests
119+
$ psql -U postgres -c "create database dpr_test_db owner=dpr_user;"
75120
```
76121

77-
## Continuous deployment process
122+
We use pytest for testing. All tests are in tests directory. To run the tests do:
78123

79124
```
80-
git pull origin master
81-
git checkout deploy
82-
# if you do not yet have the deploy branch
83-
git checkout -b deploy
84-
git merge master
85-
git push origin deploy
125+
$ pytest tests
86126
```

env.template

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1+
SQLALCHEMY_DATABASE_URI=
2+
S3_BUCKET_NAME=
13
AWS_ACCESS_KEY_ID=
24
AWS_SECRET_ACCESS_KEY=
35
AWS_REGION=
4-
AUTH0_CLIENT_ID=
5-
AUTH0_CLIENT_SECRET=
6-
AUTH0_DOMAIN=
7-
AUTH0_DB_NAME=
8-
AUTH0_API_AUDIENCE=
9-
S3_BUCKET_NAME=
10-
SQLALCHEMY_DATABASE_URI=
11-
JWT_SEED=
6+
GITHUB_CLIENT_ID=
7+
GITHUB_CLIENT_SECRET=
8+
JWT_SEED=
9+
10+
# For Deploy
11+
PROJECT=
12+
DOMAIN_BASE=
13+
STAGE=
14+
DOMAIN=%(STAGE)s.%(DOMAIN_BASE)s
15+
DPR_API_GIT=

0 commit comments

Comments
 (0)