diff --git a/backend/cli.py b/backend/cli.py index 2ebc16ba..d1c97bf7 100644 --- a/backend/cli.py +++ b/backend/cli.py @@ -5,7 +5,7 @@ import platform import subprocess import sys -from .app.celery import app +from .config.celery import app os.environ["DEBUG"] = "False" os.environ["STANDALONE"] = "True" @@ -40,7 +40,7 @@ def run_on_nix(args): self.cfg.set(key.lower(), value) def load(self): - return gunicorn.util.import_app("app.wsgi") + return gunicorn.util.import_app("config.wsgi") options = {"bind": "%s:%s" % ("0.0.0.0", args.port), "workers": number_of_workers(), "chdir": base} StandaloneApplication(options).run() @@ -48,7 +48,7 @@ def run_on_nix(args): def run_on_windows(args): from waitress import serve - from app.wsgi import application + from config.wsgi import application serve(application, port=args.port) @@ -90,7 +90,7 @@ def command_run_webserver(args): def command_run_task_queue(args): print("Starting task queue.") argv = [ - "--app=app", + "--app=config", "--workdir={}".format(base), "worker", "--loglevel=info", diff --git a/backend/app/__init__.py b/backend/config/__init__.py similarity index 100% rename from backend/app/__init__.py rename to backend/config/__init__.py diff --git a/backend/app/celery.py b/backend/config/celery.py similarity index 64% rename from backend/app/celery.py rename to backend/config/celery.py index 6ebaf0d1..7c25aa9e 100644 --- a/backend/app/celery.py +++ b/backend/config/celery.py @@ -2,9 +2,9 @@ import os from celery import Celery -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings") +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings") -app = Celery("app") +app = Celery("config") app.config_from_object("django.conf:settings", namespace="CELERY") diff --git a/backend/app/settings.py b/backend/config/settings.py similarity index 99% rename from backend/app/settings.py rename to backend/config/settings.py index 2ccdbf7a..8ecd394e 100644 --- a/backend/app/settings.py +++ b/backend/config/settings.py @@ -104,7 +104,7 @@ MIDDLEWARE = [ if DEBUG: MIDDLEWARE.append("api.middleware.RangesMiddleware") -ROOT_URLCONF = "app.urls" +ROOT_URLCONF = "config.urls" TEMPLATES = [ { @@ -136,7 +136,7 @@ STATICFILES_DIRS = [ STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" -WSGI_APPLICATION = "app.wsgi.application" +WSGI_APPLICATION = "config.wsgi.application" AUTHENTICATION_BACKENDS = [ "social_core.backends.github.GithubOAuth2", diff --git a/backend/app/urls.py b/backend/config/urls.py similarity index 100% rename from backend/app/urls.py rename to backend/config/urls.py diff --git a/backend/app/wsgi.py b/backend/config/wsgi.py similarity index 82% rename from backend/app/wsgi.py rename to backend/config/wsgi.py index 21ff6e61..e4a1b25a 100644 --- a/backend/app/wsgi.py +++ b/backend/config/wsgi.py @@ -11,6 +11,6 @@ import os from django.core.wsgi import get_wsgi_application -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings") +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings") application = get_wsgi_application() diff --git a/backend/manage.py b/backend/manage.py index e031798a..312127d5 100755 --- a/backend/manage.py +++ b/backend/manage.py @@ -3,7 +3,7 @@ import os import sys if __name__ == "__main__": - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings") + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings") try: from django.core.management import execute_from_command_line except ImportError as exc: diff --git a/docs/getting-started.md b/docs/getting-started.md index a9de7b98..3ad6ab2e 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -65,7 +65,7 @@ In another terminal, you need to run Celery to use import/export dataset feature ```bash cd doccano/backend -celery --app=app worker --loglevel=INFO --concurrency=1 +celery --app=config worker --loglevel=INFO --concurrency=1 ``` ### Node.js diff --git a/tools/dev-celery.sh b/tools/dev-celery.sh index a03d710b..ec4e61e5 100755 --- a/tools/dev-celery.sh +++ b/tools/dev-celery.sh @@ -8,5 +8,5 @@ cd "/src/backend" python manage.py wait_for_db echo "Starting celery" - "watchmedo" auto-restart --directory="." --pattern="*.py" --recursive -- "celery" --app=app worker --loglevel=info --pool=solo + "watchmedo" auto-restart --directory="." --pattern="*.py" --recursive -- "celery" --app=config worker --loglevel=info --pool=solo ) diff --git a/tools/prod-celery.sh b/tools/prod-celery.sh index 46ec087b..73c4971f 100755 --- a/tools/prod-celery.sh +++ b/tools/prod-celery.sh @@ -8,5 +8,5 @@ cd /backend python manage.py wait_for_db echo "Starting celery" - "celery" --app=app worker --loglevel=info --pool=solo + "celery" --app=config worker --loglevel=info --pool=solo ) diff --git a/tools/prod-django.sh b/tools/prod-django.sh index 08867cfc..7c38b719 100755 --- a/tools/prod-django.sh +++ b/tools/prod-django.sh @@ -25,4 +25,4 @@ if [[ -n "${ADMIN_USERNAME}" ]] && [[ -n "${ADMIN_PASSWORD}" ]] && [[ -n "${ADMI fi echo "Starting django" -gunicorn --bind="0.0.0.0:${PORT:-8000}" --workers="${WORKERS:-4}" app.wsgi --timeout 300 +gunicorn --bind="0.0.0.0:${PORT:-8000}" --workers="${WORKERS:-4}" config.wsgi --timeout 300 diff --git a/tools/run.sh b/tools/run.sh index 39fde591..84eb4cbe 100755 --- a/tools/run.sh +++ b/tools/run.sh @@ -27,10 +27,10 @@ fi echo "Starting django" # gunicorn --bind="0.0.0.0:${PORT:-8000}" --workers="${WORKERS:-4}" app.wsgi --timeout 300 -gunicorn --bind="0.0.0.0:${PORT:-8000}" --workers="${WORKERS:-1}" app.wsgi --timeout=300 & +gunicorn --bind="0.0.0.0:${PORT:-8000}" --workers="${WORKERS:-1}" config.wsgi --timeout=300 & gunicorn_pid="$!" -celery --app=app worker --loglevel=INFO --concurrency="${CELERY_WORKERS:-1}" & +celery --app=config worker --loglevel=INFO --concurrency="${CELERY_WORKERS:-1}" & celery_pid="$!" while :; do @@ -43,4 +43,4 @@ while :; do else sleep 10 fi -done \ No newline at end of file +done