mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-21 21:53:30 +00:00
repair BASE_DIR
This commit is contained in:
parent
424639ea80
commit
63b6b262c6
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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")
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user