diff --git a/README.md b/README.md index 8facfca39e..1ea66560b0 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 } } ``` diff --git a/django_spanner/base.py b/django_spanner/base.py index 1dbdde98c5..70f5b1ba39 100644 --- a/django_spanner/base.py +++ b/django_spanner/base.py @@ -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)', diff --git a/examples/from-scratch/README.md b/examples/from-scratch/README.md index d3ea86595b..f82a1e4b86 100644 --- a/examples/from-scratch/README.md +++ b/examples/from-scratch/README.md @@ -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': { @@ -57,7 +67,6 @@ DATABASES = { } ``` - ### Apply the migrations Please run: ```shell diff --git a/examples/healthchecks/README.md b/examples/healthchecks/README.md index ed053b5008..f28ed4e845 100644 --- a/examples/healthchecks/README.md +++ b/examples/healthchecks/README.md @@ -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': {