diff --git a/core/management/commands/check_fs.py b/core/management/commands/check_fs.py index 16764eb9..8e970ced 100644 --- a/core/management/commands/check_fs.py +++ b/core/management/commands/check_fs.py @@ -21,8 +21,6 @@ # # -import os - from django.core.management.base import BaseCommand from core.models import SithFile @@ -37,9 +35,6 @@ class Command(BaseCommand): ) def handle(self, *args, **options): - root_path = os.path.dirname( - os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - ) files = SithFile.objects.filter(id__in=options["ids"]).all() for f in files: f._check_fs() diff --git a/core/management/commands/repair_fs.py b/core/management/commands/repair_fs.py index 5c8cca6c..cf88d108 100644 --- a/core/management/commands/repair_fs.py +++ b/core/management/commands/repair_fs.py @@ -21,7 +21,6 @@ # # -import os from django.core.management.base import BaseCommand @@ -37,9 +36,6 @@ class Command(BaseCommand): ) def handle(self, *args, **options): - root_path = os.path.dirname( - os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - ) files = SithFile.objects.filter(id__in=options["ids"]).all() for f in files: f._repair_fs() diff --git a/core/management/commands/setup.py b/core/management/commands/setup.py index 291908e6..0db339a5 100644 --- a/core/management/commands/setup.py +++ b/core/management/commands/setup.py @@ -13,8 +13,6 @@ # # -from pathlib import Path - from django.conf import settings from django.core.management import call_command from django.core.management.base import BaseCommand @@ -26,11 +24,11 @@ class Command(BaseCommand): def handle(self, *args, **options): if not settings.DEBUG: raise Exception("Never call this command in prod. Never.") - data_dir = Path(settings.BASE_DIR) / "data" + data_dir = settings.BASE_DIR / "data" settings.EMAIL_BACKEND = "django.core.mail.backends.dummy.EmailBackend" if not data_dir.is_dir(): data_dir.mkdir() - db_path = Path(settings.BASE_DIR) / "db.sqlite3" + db_path = settings.BASE_DIR / "db.sqlite3" if db_path.exists(): call_command("flush", "--noinput") self.stdout.write("Existing database reset") diff --git a/core/views/files.py b/core/views/files.py index 83af9dd1..161578d0 100644 --- a/core/views/files.py +++ b/core/views/files.py @@ -14,7 +14,6 @@ # # This file contains all the views that concern the page model -import os from wsgiref.util import FileWrapper from ajax_select import make_ajax_field diff --git a/sith/settings.py b/sith/settings.py index 46157e79..7f2c4b0d 100644 --- a/sith/settings.py +++ b/sith/settings.py @@ -34,8 +34,6 @@ https://docs.djangoproject.com/en/1.8/ref/settings/ """ import binascii - -# Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os import sys from pathlib import Path @@ -46,7 +44,7 @@ from sentry_sdk.integrations.django import DjangoIntegration from .honeypot import custom_honeypot_error -BASE_DIR = Path(__file__).parent.parent +BASE_DIR = Path(__file__).parent.parent.resolve() os.environ["HTTPS"] = "off"