Browse Source

Update default database location in cli

pull/1710/head
Hironsan 2 years ago
parent
commit
8c040b26d3
3 changed files with 7 additions and 2 deletions
  1. 5
      backend/cli.py
  2. 2
      backend/config/settings/base.py
  3. 2
      backend/pyproject.toml

5
backend/cli.py

@ -3,14 +3,19 @@ import multiprocessing
import os
import platform
import sys
from pathlib import Path
import django
from django.core import management
from .config.celery import app
DOCCANO_HOME = os.path.expanduser(os.environ.get("DOCCANO_HOME", "~/doccano"))
Path(DOCCANO_HOME).mkdir(parents=True, exist_ok=True)
os.environ["STANDALONE"] = "True"
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.production")
os.environ.setdefault("DATABASE_URL", os.path.join(f"sqlite:///{DOCCANO_HOME}", "db.sqlite3"))
os.environ.setdefault("MEDIA_ROOT", os.path.join(DOCCANO_HOME, "media"))
base = os.path.abspath(os.path.dirname(__file__))
sys.path.append(base)
django.setup()

2
backend/config/settings/base.py

@ -239,7 +239,7 @@ if not EMAIL_HOST:
# User media files
MEDIA_ROOT = path.join(BASE_DIR, "media")
MEDIA_ROOT = env("MEDIA_ROOT", path.join(BASE_DIR, "media"))
MEDIA_URL = "/media/"
# Filepond settings

2
backend/pyproject.toml

@ -55,7 +55,7 @@ auto-labeling-pipeline = "^0.1.21"
dj-rest-auth = "^2.2.3"
django-drf-filepond = "^0.4.1"
celery = "^5.2.3"
django-celery-results = "^2.2.0"
django-celery-results = "2.2.0"
SQLAlchemy = "^1.4.31"
waitress = "^2.0.0"
django-health-check = "^3.16.5"

Loading…
Cancel
Save