Skip to content

Commit 4b5a791

Browse files
committed
README, examples: add django_spanner as first entry into INSTALLED_APPS
Also while here, fixed a typo in a setting field for `DATABASES` that used DATABASE instead of NAME for the name of the database. Fixes #433
1 parent 49387d2 commit 4b5a791

File tree

3 files changed

+35
-6
lines changed

3 files changed

+35
-6
lines changed

packages/django-google-spanner/README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,17 @@ pip3 install --user .
3636
```
3737

3838
## Using it
39-
After [installing it](#installing-it), you'll need to edit your Django `settings.py` file
40-
and particularly the `DATABASES` section to point to an EXISTING database, of the format:
39+
After [installing it](#installing-it), you'll need to edit your Django `settings.py` file:
40+
41+
* Add `django_spanner` as the very first entry in the `INSTALLED_APPS` setting
42+
```python
43+
INSTALLED_APPS = [
44+
'django_spanner',
45+
...
46+
]
47+
```
48+
49+
* Edit the `DATABASES` setting to point to an EXISTING database
4150

4251
### Format
4352

@@ -66,7 +75,7 @@ DATABASES = {
6675
'ENGINE': 'django_spanner',
6776
'PROJECT': 'appdev-soda-spanner-staging', # Or the GCP project-id
6877
'INSTANCE': 'django-dev1', # Or the Cloud Spanner instance
69-
'DATABASE': 'db1', # Or the Cloud Spanner database to use
78+
'NAME': 'db1', # Or the Cloud Spanner database to use
7079
}
7180
}
7281
```

packages/django-google-spanner/examples/from-scratch/README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,17 @@ After we have a Cloud Spanner database created, we'll need a few variables:
2626
* Instance name
2727
* Database name aka DisplayName
2828

29-
Once in, please edit the file `hc/local_settings.py` and make the section `DATABASES` into the following:
29+
Once in, please edit the file `hc/local_settings.py`, and:
30+
31+
a) add `django_spanner` as the very first entry to your `INSTALLED_APPS`
32+
```python
33+
INSTALLED_APPS = [
34+
'django_spanner', # Must be listed first.
35+
...
36+
]
37+
```
38+
39+
b) update `DATABASES` into the following:
3040
```python
3141
DATABASES = {
3242
'default': {
@@ -57,7 +67,6 @@ DATABASES = {
5767
}
5868
```
5969

60-
6170
### Apply the migrations
6271
Please run:
6372
```shell

packages/django-google-spanner/examples/healthchecks/README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,18 @@ After we have a Cloud Spanner database created, we'll need a few variables:
6161
* Instance name
6262
* Database name aka DisplayName
6363

64-
Once in, please edit the file `hc/local_settings.py` and make the section `DATABASES` into the following:
64+
Once in, please edit the file `hc/local_settings.py` to:
65+
a) Add `django_spanner` as the first entry to `INSTALLED_APPS`
66+
```python
67+
INSTALLED_APPS = [
68+
'django_spanner', # Must be listed first.
69+
...
70+
]
71+
```
72+
**The rest of the apps MUST be copied from hc/settings.py**
73+
74+
75+
b) Edit `DATABASES` into the following:
6576
```python
6677
DATABASES = {
6778
'default': {

0 commit comments

Comments
 (0)