Skip to content

Commit

Permalink
use connection string and Bucket classes
Browse files Browse the repository at this point in the history
  • Loading branch information
mnunberg committed Mar 3, 2015
1 parent af85fe7 commit 00c5fc8
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions beer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from flask import Flask, request, redirect, abort, render_template

from couchbase import Couchbase
from couchbase.bucket import Bucket
from couchbase.exceptions import KeyExistsError, NotFoundError
from couchbase.views.iterator import RowProcessor
from couchbase.views.params import UNSPEC, Query
Expand Down Expand Up @@ -50,19 +50,17 @@ def handle_rows(self, rows, connection, include_docs):

return ret

DATABASE = 'beer-sample'
HOST = 'localhost'
ENTRIES_PER_PAGE = 30

CONNSTR = 'couchbase://localhost/beer-sample'
ENTRIES_PER_PAGE = 30


app = Flask(__name__, static_url_path='')
app.config.from_object(__name__)


def connect_db():
return Couchbase.connect(
bucket=app.config['DATABASE'],
host=app.config['HOST'])
return Bucket(CONNSTR)


db = connect_db()
Expand Down

0 comments on commit 00c5fc8

Please sign in to comment.