Permalink
Browse files

Merge pull request #2 from j4mie/sqlite

Add support for SQLite
  • Loading branch information...
2 parents dbd4d7a + 34ecac9 commit a60e0fdbdb8e48894437602eb1a7b66a270bb408 @kennethreitz committed May 1, 2012
Showing with 15 additions and 2 deletions.
  1. +10 −1 README.rst
  2. +5 −1 dj_database_url.py
View
11 README.rst
@@ -17,10 +17,19 @@ Parse an arbitrary Database URL::
DATABASES['default'] = dj_database_url.parse('postgres://...')
+Supported databases
+-------------------
+
+Support currently exists for PostgreSQL, MySQL and SQLite.
+
+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``.
Installation
------------
Installation is simple too::
- $ pip install dj-database-url
+ $ pip install dj-database-url
View
6 dj_database_url.py
@@ -6,6 +6,7 @@
# Register database schemes in URLs.
urlparse.uses_netloc.append('postgres')
urlparse.uses_netloc.append('mysql')
+urlparse.uses_netloc.append('sqlite')
DEFAULT_ENV = 'DATABASE_URL'
@@ -42,4 +43,7 @@ def parse(url):
if url.scheme == 'mysql':
config['ENGINE'] = 'django.db.backends.mysql'
- return config
+ if url.scheme == 'sqlite':
+ config['ENGINE'] = 'django.db.backends.sqlite3'
+
+ return config

0 comments on commit a60e0fd

Please sign in to comment.