allow arbitrary path for sqlite using DATABASE_URL
This commit is contained in:
parent
e89c1742fb
commit
8bee2e3976
@ -358,6 +358,8 @@ if os.getenv('DATABASE_URL'):
|
|||||||
if schema.startswith('postgres'):
|
if schema.startswith('postgres'):
|
||||||
engine = 'django.db.backends.postgresql'
|
engine = 'django.db.backends.postgresql'
|
||||||
elif schema == 'sqlite':
|
elif schema == 'sqlite':
|
||||||
|
if not os.path.exists(db_path := os.path.dirname(settings['database'])):
|
||||||
|
os.makedirs(db_path)
|
||||||
engine = 'django.db.backends.sqlite3'
|
engine = 'django.db.backends.sqlite3'
|
||||||
else:
|
else:
|
||||||
raise Exception("Unsupported database schema: '%s'" % schema)
|
raise Exception("Unsupported database schema: '%s'" % schema)
|
||||||
|
Loading…
Reference in New Issue
Block a user