Skip to main content

Use the ZODB with Flask

Project description

http://packages.python.org/Flask-ZODB/_static/flask-zodb.png

Transparent and scalable persistence of Python objects for Flask applications. Use it as your database or as a complement to another database - for example PostgreSQL where you need to perform rich queries and ZODB where you need structured data and mapping to and from Python types is inconvenient.

app = Flask(__name__)
db = ZODB(app)

@app.before_request
def set_db_defaults():
    if 'entries' not in db:
        db['entries'] = List()

@app.route('/')
def show_entries():
    return render_template('show_entries.html', entries=db['entries'])


@app.route('/add', methods=['POST'])
def add_entry():
    db['entries'].append(request.form)
    flash('New entry was successfully posted')
    return redirect(url_for('show_entries'))

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

Flask-ZODB-0.1.tar.gz (10.2 kB view details)

Uploaded Source

File details

Details for the file Flask-ZODB-0.1.tar.gz.

File metadata

  • Download URL: Flask-ZODB-0.1.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Flask-ZODB-0.1.tar.gz
Algorithm Hash digest
SHA256 7646219b757e70fc1073e4e3a014b4194cd63575e7a02a7171e874f59ae68e8f
MD5 cec1fbfa77809dfdc8af3b139ca2a73d
BLAKE2b-256 ec9324a493cc964128bf78eb2b178ce9db1b712b8a26819859d2f12de1e2a28f

See more details on using hashes here.

Supported by

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