Skip to main content

Use Database URLs in your Peewee ORM application.

Project description

This simple Python utility allows you to utilize the 12factor inspired DATABASE_URL environment variable to configure your Peewee ORM application.

All credit goes to Kenneth Reitz for this one, as it’s a direct port of his dj-database-url utility for Django apps.

Usage

Configure your database from DATABASE_URL:

DATABASE = pw_database_url.config()

Parse an arbitrary Database URL:

DATABASE = pw_database_url.parse('postgres://...')

Supported databases

Support currently exists for PostgreSQL, MySQL and SQLite.

In addition, support for Postgres specific features can be enabled by using the postgresext:// pattern. This will give you access to the HStoreField type. See the peewee docs for usage information and examples.

SQLite connects to file based databases. The same URL format is used, omitting the hostname, and using the “file” portion as the filename of the database. This has the effect of four slashes being present for an absolute file path: sqlite:////full/path/to/your/database/file.sqlite.

Project details


Download files

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

Source Distribution

pw-database-url-0.2.0.tar.gz (2.4 kB view details)

Uploaded Source

File details

Details for the file pw-database-url-0.2.0.tar.gz.

File metadata

File hashes

Hashes for pw-database-url-0.2.0.tar.gz
Algorithm Hash digest
SHA256 24a0a2ef935cb591ac5e56b388ee89de1b7fe9935629bc783bec89589015413a
MD5 9ff948f8643d48ceecec34ed0604d0f1
BLAKE2b-256 cd31746fc73803f3acb344802e02ca9a52c6cf4738f987833764fea3cf456293

See more details on using hashes here.

Supported by

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