Variable Name | Description | Default value |
---|---|---|
FLASK_APP | The name of your application | couchbase-flask-starter |
COUCHBASE_CONNECTION_STRING | A couchbase connection string | - |
COUCHBASE_USERNAME | Username for authentication with Couchbase | - |
COUCHBASE_PASSWORD | Password for authentication with Couchbase | - |
COUCHBASE_USE_CAPELLA | Use to change the connection profile | false |
COUCHBASE_DEFAULT_BUCKET | The name of the Couchbase Bucket, parent of the scope | default |
COUCHBASE_DEFAULT_SCOPE | The name of the Couchbase scope, parent of the collection | _default |
COUCHBASE_DEFAULT_COLLECTION | The name of the Couchbase collection to store the Documents | _default |
Follow these steps to get the starter kit up and running on yoru local machine.
Make sure you have the following installed:
- Python 3.x
- Git
git clone https://github.com/couchbase-starter-kit/couchbase-flask-starter.git
cd couchbase-flask-starter
pip3 install -r "requirements.txt"
Copy the .env.sample
file in the root directory of the project and rename it to .env
. Update the .env
file with your Couchbase credentials as follows:
FLASK_APP=couchbase-flask-starter
COUCHBASE_CONNECTION_STRING="couchbase://localhost"
COUCHBASE_USERNAME="Administrator"
COUCHBASE_PASSWORD="password"
COUCHBASE_USE_CAPELLA=false
COUCHBASE_DEFAULT_BUCKET="default"
COUCHBASE_DEFAULT_SCOPE="_default"
COUCHBASE_DEFAULT_COLLECTION="_default"
You can obtain those credentials by first creating an account on Couchbase Capella at https://cloud.couchbase.com/ and then creating a database. Inside the database, create a bucket. The name of the bucket is what you should use for the COUCHBASE_DEFAULT_BUCKET
environment variable.
Once you have done so, you can navigate to the Connect
tab in the database and copy the connection string URL. This is what you should use for the COUCHBASE_CONNECTION_STRING
environment variable. You will also need to create a user with the appropriate permissions and use the username and password for the COUCHBASE_USERNAME
and COUCHBASE_PASSWORD
environment variables.
Unit tests are run using pytest.
To run the test suite, use the following command:
pytest
To run the application, use the following command:
python run.py
This project is configured to work with Gitpod. Click the "Open in Gitpod" button above to start a new workspace.