Skip to content

Commit

Permalink
Merge branch 'master' into test-to-contributing
Browse files Browse the repository at this point in the history
  • Loading branch information
odeke-em committed Apr 25, 2020
2 parents 7b64360 + 3345933 commit 63a7c84
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 11 deletions.
15 changes: 12 additions & 3 deletions README.md
Expand Up @@ -36,8 +36,17 @@ pip3 install --user .
```

## Using it
After [installing it](#installing-it), you'll need to edit your Django `settings.py` file
and particularly the `DATABASES` section to point to an EXISTING database, of the format:
After [installing it](#installing-it), you'll need to edit your Django `settings.py` file:

* Add `django_spanner` as the very first entry in the `INSTALLED_APPS` setting
```python
INSTALLED_APPS = [
'django_spanner',
...
]
```

* Edit the `DATABASES` setting to point to an EXISTING database

### Format

Expand Down Expand Up @@ -66,7 +75,7 @@ DATABASES = {
'ENGINE': 'django_spanner',
'PROJECT': 'appdev-soda-spanner-staging', # Or the GCP project-id
'INSTANCE': 'django-dev1', # Or the Cloud Spanner instance
'DATABASE': 'db1', # Or the Cloud Spanner database to use
'NAME': 'db1', # Or the Cloud Spanner database to use
}
}
```
Expand Down
5 changes: 0 additions & 5 deletions django_spanner/base.py
Expand Up @@ -52,11 +52,6 @@ class DatabaseWrapper(BaseDatabaseWrapper):
'TimeField': 'TIMESTAMP',
'UUIDField': 'STRING(32)',
}

# TODO: (@odeke-em) examine Spanner's data type constraints.
data_types_check_constraints = {
}

operators = {
'exact': '= %s',
'iexact': 'REGEXP_CONTAINS(%s, %%%%s)',
Expand Down
13 changes: 11 additions & 2 deletions examples/from-scratch/README.md
Expand Up @@ -26,7 +26,17 @@ After we have a Cloud Spanner database created, we'll need a few variables:
* Instance name
* Database name aka DisplayName

Once in, please edit the file `hc/local_settings.py` and make the section `DATABASES` into the following:
Once in, please edit the file `hc/local_settings.py`, and:

a) add `django_spanner` as the very first entry to your `INSTALLED_APPS`
```python
INSTALLED_APPS = [
'django_spanner', # Must be listed first.
...
]
```

b) update `DATABASES` into the following:
```python
DATABASES = {
'default': {
Expand Down Expand Up @@ -57,7 +67,6 @@ DATABASES = {
}
```


### Apply the migrations
Please run:
```shell
Expand Down
13 changes: 12 additions & 1 deletion examples/healthchecks/README.md
Expand Up @@ -61,7 +61,18 @@ After we have a Cloud Spanner database created, we'll need a few variables:
* Instance name
* Database name aka DisplayName

Once in, please edit the file `hc/local_settings.py` and make the section `DATABASES` into the following:
Once in, please edit the file `hc/local_settings.py` to:
a) Add `django_spanner` as the first entry to `INSTALLED_APPS`
```python
INSTALLED_APPS = [
'django_spanner', # Must be listed first.
...
]
```
**The rest of the apps MUST be copied from hc/settings.py**


b) Edit `DATABASES` into the following:
```python
DATABASES = {
'default': {
Expand Down

0 comments on commit 63a7c84

Please sign in to comment.