Skip to main content

Flask Cloud NDB: Adds Google Cloud NDB support to Flask

Project description

Flask-Cloud-NDB is an extension for Flask that adds support for Google Cloud NDB to your application.

Installing

Install and update using pip:

$ pip install -U Flask-Cloud-NDB

A Simple Example

from flask import Flask
from google.cloud import ndb
from flask_cloud_ndb import CloudNDB

app = Flask(__name__)
cloud_ndb = CloudNDB(app)


class Note(ndb.Model):
    title = ndb.StringProperty()
    content = ndb.StringProperty()
    created_at = ndb.DateTimeProperty()


@app.route('/')
def index():
    Note(
        title="Flask Cloud NDB with request",
        content="This is an extension, and here is an example"
        " of how to use within a request").put()

    notes = Note.query().fetch()

    return notes[0].title


# we can also simply use the context wrapper:
with cloud_ndb.context():
    Note(
        title="Flask Cloud NDB without request",
        content="This is an extension, and here is an example "
        "of how to use without request").put()
    notes = Note.query().fetch()
    print(notes[0].title)


if __name__ == '__main__':
    app.run()

Configuration Options

By default the extension will run by itself in the cloud, without any additional configurations, using the default app engine credentials.

TODOS

  • Add full configuration options description in readme

  • Add black formatting

  • Add more links to readme

  • Add more documentation to code

  • Add changes file

  • Complete manifest.in file

  • Complete setup.cfg file

  • Add tests!!

  • Add coverage

  • Build distribution for pypi

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

Flask_Cloud_NDB-0.2.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file Flask_Cloud_NDB-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: Flask_Cloud_NDB-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.4

File hashes

Hashes for Flask_Cloud_NDB-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8af8655739a04f987679284749def6bd61a93a2e4d4f923eceaedd7600f9243d
MD5 38f5586ac832ce00d7a677754ef67abb
BLAKE2b-256 05c7bac026296c7446ea3526bfede56e8229d7e5352065a18ec9653c73cf6bd8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page