Browse Source
Merge pull request #1710 from doccano/enhancement/databaseLocation
Update default database location in cli
pull/1712/head
Hiroki Nakayama
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
7 additions and
2 deletions
-
backend/cli.py
-
backend/config/settings/base.py
-
backend/pyproject.toml
|
|
@ -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() |
|
|
|
|
|
@ -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 |
|
|
|
|
|
@ -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" |
|
|
|