From a14743d00b045185d54979d6f8668e68891fa867 Mon Sep 17 00:00:00 2001 From: carlio Date: Sat, 5 Jan 2013 11:25:37 +0100 Subject: [PATCH] Handling special case of sqlite://:memory: --- dj_database_url.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dj_database_url.py b/dj_database_url.py index 58d7ed6..2bd8e4d 100644 --- a/dj_database_url.py +++ b/dj_database_url.py @@ -45,6 +45,17 @@ def config(env=DEFAULT_ENV, default=None): def parse(url): """Parses a database URL.""" + if url == 'sqlite://:memory:': + # this is a special case, because if we pass this URL into + # urlparse, urlparse will choke trying to interpret "memory" + # as a port number + return { + 'ENGINE': SCHEMES['sqlite'], + 'NAME': ':memory:' + } + # note: no other settings are required for sqlite + + # otherwise parse the url as normal config = {} url = urlparse.urlparse(url)