Skip to content
This repository was archived by the owner on Mar 20, 2026. It is now read-only.

Commit 6a83e12

Browse files
cuu508vi3k6i5
andauthored
Update Healthchecks instructions (#738)
- remove the note about Django 2.2 being the only supported version (3.2 seems to work too) - change the install instructions to install from PyPI - fix Markdown formatting for python code blocks Co-authored-by: Vikash Singh <3116482+vi3k6i5@users.noreply.github.com>
1 parent 2f05b47 commit 6a83e12

1 file changed

Lines changed: 36 additions & 55 deletions

File tree

examples/healthchecks/README.md

Lines changed: 36 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22

33
This example shows how to use django-spanner for Cloud Spanner as a backend database for [https://healthchecks.io](https://healthchecks.io)
44

5-
*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.)
6-
75
### Table of contents
86
- [Install healthchecks](#install-healthchecks)
9-
- [Clone django-spanner](#clone-django-spanner)
107
- [Install django-spanner in the virtual-env](#install-django-spanner-in-the-virtual-env)
118
- [Ensure you have a Cloud Spanner database already created](#ensure-you-have-a-Cloud-Spanner-database-already-created)
129
- [Set credentials and project environment variables](#Set-credentials-and-project-environment-variables)
@@ -21,35 +18,19 @@ This example shows how to use django-spanner for Cloud Spanner as a backend data
2118
Please follow the instructions to install [healthchecks.io on Github](https://github.com/healthchecks/healthchecks/).
2219
You'll need to active the virtual-env as their install instructions request.
2320

24-
### Clone django-spanner
25-
Open a fresh terminal, and go to a location that isn't a parent directory of where you cloned [healthchecks.io](#install-healthchecks).
26-
For example we can go to our $HOME/Desktop
27-
```shell
28-
cd $HOME/Desktop
29-
git clone https://github.com/googleapis/python-spanner-django
30-
```
21+
### Install django-spanner in the virtual-env
3122

32-
Note the full path of where django-spanner has been cloned into, for example
33-
```shell
34-
DJANGO_SPANNER_CODE_DIR=$Desktop/python-spanner-django
35-
```
36-
or add it to your environment, perhaps like this
37-
```shell
38-
export DJANGO_SPANNER_CODE_DIR=$Desktop/python-spanner-django
39-
```
23+
Go to the directory in which you installed [healthchecks](#install-healthchecks)
24+
and ensure your virtual-env is on. The prompt should look something like this:
4025

41-
### Install django-spanner in the virtual-env
42-
Go back to the directory in which you installed [healthchecks](#install-healthchecks) and ensure your virtual-env is on.
43-
Ensure that your environment is reloaded to get the settings for $DJANGO_SPANNER_CODE, or ensure you had manually copied that path.
44-
The prompt should look something like this
4526
```shell
4627
(hc-venv) $
4728
```
4829

49-
now install django-spanner using the path you obtained in [Clone django-spanner](#clone-django-spanner), per
30+
Install django-google-spanner from PyPI:
5031

5132
```shell
52-
(h-venv) $ pip3 install $DJANGO_SPANNER_CODE_DIR
33+
(h-venv) $ pip install django-google-spanner
5334
```
5435

5536
### Ensure you have a Cloud Spanner database already created
@@ -79,50 +60,50 @@ There are two ways to edit settings file:
7960

8061
a) Add `django_spanner` as the first entry to `INSTALLED_APPS`:
8162

82-
```python
83-
INSTALLED_APPS = [
84-
'django_spanner', # Must be listed first.
85-
...
86-
]
87-
```
63+
```python
64+
INSTALLED_APPS = [
65+
'django_spanner', # Must be listed first.
66+
...
67+
]
68+
```
8869

8970
b) Edit `DATABASES` into the following:
9071

91-
```python
92-
DATABASES = {
93-
'default': {
94-
'ENGINE': 'django_spanner',
95-
'PROJECT': PROJECT_ID,
96-
'INSTANCE': SPANNER_INSTANCE,
97-
'NAME': SPANNER_DATABASE_NAME,
98-
}
72+
```python
73+
DATABASES = {
74+
'default': {
75+
'ENGINE': 'django_spanner',
76+
'PROJECT': PROJECT_ID,
77+
'INSTANCE': SPANNER_INSTANCE,
78+
'NAME': SPANNER_DATABASE_NAME,
9979
}
100-
```
80+
}
81+
```
10182

10283
2. You can edit the file `hc/local_settings.py` to:
10384

104-
a) The `INSTALLED_APPS` MUST be copied from hc/settings.py to hc/local_settings.py
85+
a) The `INSTALLED_APPS` MUST be copied from `hc/settings.py` to `hc/local_settings.py`
10586
and add `django_spanner` as the first entry to `INSTALLED_APPS`:
10687

107-
```python
108-
INSTALLED_APPS = [
109-
'django_spanner', # Must be listed first.
110-
...
111-
]
112-
```
88+
```python
89+
INSTALLED_APPS = [
90+
'django_spanner', # Must be listed first.
91+
...
92+
]
93+
```
11394

11495
b) Add or Edit `DATABASES` into the following:
11596

116-
```python
117-
DATABASES = {
118-
'default': {
119-
'ENGINE': 'django_spanner',
120-
'PROJECT': PROJECT_ID,
121-
'INSTANCE': SPANNER_INSTANCE,
122-
'NAME': SPANNER_DATABASE_NAME,
123-
}
97+
```python
98+
DATABASES = {
99+
'default': {
100+
'ENGINE': 'django_spanner',
101+
'PROJECT': PROJECT_ID,
102+
'INSTANCE': SPANNER_INSTANCE,
103+
'NAME': SPANNER_DATABASE_NAME,
124104
}
125-
```
105+
}
106+
```
126107

127108
and for example here is a filled in database where:
128109

0 commit comments

Comments
 (0)