Skip to content

Commit 68b7f98

Browse files
fix: add project env in readme file (#586)
1 parent c689c2e commit 68b7f98

2 files changed

Lines changed: 27 additions & 14 deletions

File tree

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,18 @@ This example shows how to use django-spanner for Cloud Spanner as a backend data
44

55
*NOTE:* Use the version of python-spanner-django that corresponds to your version of Django. For example, python-spanner-django 2.2.x works with Django 2.2.y. (This is the only supported version at this time.)
66

7-
### Walkthrough the introduction to Django
7+
### Table of contents
8+
- [Install django-spanner](#install-django-spanner)
9+
- [Ensure you have a Cloud Spanner database already created](#ensure-you-have-a-cloud-spanner-database-already-created)
10+
- [Follow the tutorial](#follow-the-tutorial)
11+
- [Update your settings.py file to use django-spanner](#update-your-settings.py-file-to-use-django-spanner)
12+
- [Set credentials and project environment variables](#Set-credentials-and-project-environment-variables)
13+
- [Apply the migrations](#apply-the-migrations)
14+
- [Now run your server](#now-run-your-server)
15+
- [Create an Django admin user](#create-an-django-admin-user)
16+
- [Login as admin](#login-as-admin)
17+
- [Comprehensive hands-on guide](#comprehensive-hands-on-guide)
18+
- [References](#references)
819

920
### Install django-spanner
1021
To install from PyPI:
@@ -74,10 +85,11 @@ DATABASES = {
7485
}
7586
```
7687

77-
### Set Google Application Default Credentials to the environment
78-
You'll need to download a service account JSON key file and point to it using an environment variable:
88+
### Set credentials and project environment variables
89+
You'll need to download a service account JSON key file and point to it using an environment variable:
7990
```shell
8091
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/keyfile.json
92+
export GOOGLE_CLOUD_PROJECT=gcloud_project
8193
```
8294

8395
### Apply the migrations

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

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This example shows how to use django-spanner for Cloud Spanner as a backend data
99
- [Clone django-spanner](#clone-django-spanner)
1010
- [Install django-spanner in the virtual-env](#install-django-spanner-in-the-virtual-env)
1111
- [Ensure you have a Cloud Spanner database already created](#ensure-you-have-a-Cloud-Spanner-database-already-created)
12-
- [Set Google Application Default Credentials to the environment](#Set-Google-Application-Default-Credentials-to-the-environment)
12+
- [Set credentials and project environment variables](#Set-credentials-and-project-environment-variables)
1313
- [Update local_settings.py](#update-local_settings.py)
1414
- [Run the server](#run-the-server)
1515
- [Apply the migrations](#apply-the-migrations)
@@ -56,11 +56,12 @@ now install django-spanner using the path you obtained in [Clone django-spanner]
5656
If you haven't already, please follow the steps to install [Cloud Spanner](https://cloud.google.com/spanner/docs/getting-started/set-up),
5757
or visit this [codelab](https://opencensus.io/codelabs/spanner/#0)
5858

59-
### Set Google Application Default Credentials to the environment
60-
You'll need to download a service account JSON keyfile and point to it using an environment variable:
59+
### Set credentials and project environment variables
60+
You'll need to download a service account JSON keyfile and point to it using an environment variable:
6161

6262
```shell
6363
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/keyfile.json
64+
export GOOGLE_CLOUD_PROJECT=gcloud_project
6465
```
6566

6667
### Update local_settings.py
@@ -70,23 +71,23 @@ After we have a Cloud Spanner database created, we'll need a few variables:
7071
* Database name aka DisplayName
7172

7273

73-
*NOTE:* Healthchecks's `local_settings.py` overrides the default settings
74+
*NOTE:* Healthchecks's `local_settings.py` overrides the default settings
7475
mentioned in `settings.py`.
7576

7677
There are two ways to edit settings file:
77-
1. You can edit the file `hc/settings.py` to:
78-
78+
1. You can edit the file `hc/settings.py` to:
79+
7980
a) Add `django_spanner` as the first entry to `INSTALLED_APPS`:
80-
81+
8182
```python
8283
INSTALLED_APPS = [
8384
'django_spanner', # Must be listed first.
8485
...
8586
]
8687
```
87-
88+
8889
b) Edit `DATABASES` into the following:
89-
90+
9091
```python
9192
DATABASES = {
9293
'default': {
@@ -102,7 +103,7 @@ There are two ways to edit settings file:
102103

103104
a) The `INSTALLED_APPS` MUST be copied from hc/settings.py to hc/local_settings.py
104105
and add `django_spanner` as the first entry to `INSTALLED_APPS`:
105-
106+
106107
```python
107108
INSTALLED_APPS = [
108109
'django_spanner', # Must be listed first.
@@ -111,7 +112,7 @@ There are two ways to edit settings file:
111112
```
112113

113114
b) Add or Edit `DATABASES` into the following:
114-
115+
115116
```python
116117
DATABASES = {
117118
'default': {

0 commit comments

Comments
 (0)