This commit is contained in:
Mikan
2024-09-16 17:36:22 +03:00
parent 6a25c1ad79
commit 46a0eae7d1

View File

@@ -6,14 +6,14 @@ __all__ = ["default_database"]
BASE_DIR = Path(__file__).resolve().parent
if not os.path.exists('config.json'):
with open('config.json', 'w', encoding='utf-8') as config_file:
if not os.path.exists(os.path.join(BASE_DIR, 'config.json')):
with open(os.path.join(BASE_DIR, 'config.json'), 'w', encoding='utf-8') as config_file:
json.dump({
'ENGINE': 'django.db.backends.sqlite3',
'NAME': str(BASE_DIR / 'db.sqlite3'),
}, config_file, ensure_ascii=False, indent=4)
with open('config.json', 'r', encoding='utf-8') as config_file:
with open(os.path.join(BASE_DIR, 'config.json'), 'r', encoding='utf-8') as config_file:
default_database = json.load(config_file)