Browse Source

Replaced os.path in settings.py

Angel Rey 5 years ago
parent
commit
0e7c337dcb
1 changed files with 8 additions and 7 deletions
  1. 8 7
      archivebox/core/settings.py

+ 8 - 7
archivebox/core/settings.py

@@ -2,6 +2,7 @@ __package__ = 'archivebox.core'
 
 import os
 import sys
+from pathlib import Path
 from django.utils.crypto import get_random_string
 
 
@@ -49,9 +50,9 @@ TEMPLATES = [
     {
         'BACKEND': 'django.template.backends.django.DjangoTemplates',
         'DIRS': [
-            os.path.join(PYTHON_DIR, 'themes', ACTIVE_THEME),
-            os.path.join(PYTHON_DIR, 'themes', 'default'),
-            os.path.join(PYTHON_DIR, 'themes'),
+            Path(PYTHON_DIR) / 'themes' / ACTIVE_THEME,
+            Path(PYTHON_DIR) / 'themes' / 'default',
+            Path(PYTHON_DIR) / 'themes',
         ],
         'APP_DIRS': True,
         'OPTIONS': {
@@ -70,7 +71,7 @@ WSGI_APPLICATION = 'core.wsgi.application'
 DATABASES = {
     'default': {
         'ENGINE': 'django.db.backends.sqlite3',
-        'NAME': os.path.join(OUTPUT_DIR, SQL_INDEX_FILENAME),
+        'NAME': Path(OUTPUT_DIR) / SQL_INDEX_FILENAME,
     }
 }
 
@@ -105,7 +106,7 @@ SHELL_PLUS_PRINT_SQL = False
 IPYTHON_ARGUMENTS = ['--no-confirm-exit', '--no-banner']
 IPYTHON_KERNEL_DISPLAY_NAME = 'ArchiveBox Django Shell'
 if IS_SHELL:
-    os.environ['PYTHONSTARTUP'] = os.path.join(PYTHON_DIR, 'core', 'welcome_message.py')
+    os.environ['PYTHONSTARTUP'] = Path(PYTHON_DIR) / 'core' / 'welcome_message.py'
 
 
 LANGUAGE_CODE = 'en-us'
@@ -122,6 +123,6 @@ EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
 
 STATIC_URL = '/static/'
 STATICFILES_DIRS = [
-    os.path.join(PYTHON_DIR, 'themes', ACTIVE_THEME, 'static'),
-    os.path.join(PYTHON_DIR, 'themes', 'default', 'static'),
+    Path(PYTHON_DIR) / 'themes' / ACTIVE_THEME / 'static',
+    Path(PYTHON_DIR) / 'themes' / 'default' / 'static',
 ]