mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Refs #29983 -- Added support for using pathlib.Path in all settings.
This commit is contained in:
committed by
Carlton Gibson
parent
367634f976
commit
77aa74cb70
@@ -174,7 +174,9 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
||||
"settings.DATABASES is improperly configured. "
|
||||
"Please supply the NAME value.")
|
||||
kwargs = {
|
||||
'database': settings_dict['NAME'],
|
||||
# TODO: Remove str() when dropping support for PY36.
|
||||
# https://bugs.python.org/issue33496
|
||||
'database': str(settings_dict['NAME']),
|
||||
'detect_types': Database.PARSE_DECLTYPES | Database.PARSE_COLNAMES,
|
||||
**settings_dict['OPTIONS'],
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from django.db.backends.base.creation import BaseDatabaseCreation
|
||||
|
||||
@@ -9,7 +10,9 @@ class DatabaseCreation(BaseDatabaseCreation):
|
||||
|
||||
@staticmethod
|
||||
def is_in_memory_db(database_name):
|
||||
return database_name == ':memory:' or 'mode=memory' in database_name
|
||||
return not isinstance(database_name, Path) and (
|
||||
database_name == ':memory:' or 'mode=memory' in database_name
|
||||
)
|
||||
|
||||
def _get_test_db_name(self):
|
||||
test_database_name = self.connection.settings_dict['TEST']['NAME'] or ':memory:'
|
||||
|
||||
Reference in New Issue
Block a user