For Couchbase Server 5.0 see this branch for latest changes to authentication
This is a sample application for getting started with Couchbase Server and the Python SDK. The application runs a single page web UI for demonstrating SQL for Documents (N1QL), Sub-document requests and Full Text Search (FTS) querying capabilities. It uses Couchbase Server together with the Python Flask web platform, Angular2 and Bootstrap.
The application is a flight planner that allows the user to search for and select a flight route (including the return flight) based on airports and dates. Airport selection is done dynamically using an angular autocomplete box bound to N1QL queries on the server side. After selecting a date, it then searches for applicable air flight routes from a previously populated database. An additional page allows users to search for Hotels using less structured keywords.
The following pieces need to be in place in order to run the application.
- Couchbase Server 4.5 or later with the travel-sample bucket setup
- Couchbase C Library - libcouchbase
- Full text search index on travel-sample bucket called 'hotels'
- Python 2.7 or greater
To download the application you can either download the archive or clone the repository:
$ git clone https://github.com/couchbaselabs/try-cb-python.git
The application uses several Python libraries that need to be installed, this are listed in requirements.txt and can be automatically loaded using the pip command:
$ pip install -r requirements.txt
Launch the application by running the travel.py file from a terminal. It will tell you the port on localhost to goto in your web browser:
$ python travel.py
* Running on http://localhost:8080/ (Press CTRL+C to quit)
To end the application press CONTROL+C in the terminal.
By default the application will connect to the Couchbase Server on http://localhost:8091 and use the travel-sample bucket.
It will however separate user account data into the default bucket. These options can be modified in travel.py
.