Browse Source

Rename directory name from app to config

pull/1683/head
Hironsan 2 years ago
parent
commit
2d741c3635
12 changed files with 17 additions and 17 deletions
  1. 8
      backend/cli.py
  2. 0
      backend/config/__init__.py
  3. 4
      backend/config/celery.py
  4. 4
      backend/config/settings.py
  5. 0
      backend/config/urls.py
  6. 2
      backend/config/wsgi.py
  7. 2
      backend/manage.py
  8. 2
      docs/getting-started.md
  9. 2
      tools/dev-celery.sh
  10. 2
      tools/prod-celery.sh
  11. 2
      tools/prod-django.sh
  12. 6
      tools/run.sh

8
backend/cli.py

@ -5,7 +5,7 @@ import platform
import subprocess import subprocess
import sys import sys
from .app.celery import app
from .config.celery import app
os.environ["DEBUG"] = "False" os.environ["DEBUG"] = "False"
os.environ["STANDALONE"] = "True" os.environ["STANDALONE"] = "True"
@ -40,7 +40,7 @@ def run_on_nix(args):
self.cfg.set(key.lower(), value) self.cfg.set(key.lower(), value)
def load(self): 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} options = {"bind": "%s:%s" % ("0.0.0.0", args.port), "workers": number_of_workers(), "chdir": base}
StandaloneApplication(options).run() StandaloneApplication(options).run()
@ -48,7 +48,7 @@ def run_on_nix(args):
def run_on_windows(args): def run_on_windows(args):
from waitress import serve from waitress import serve
from app.wsgi import application
from config.wsgi import application
serve(application, port=args.port) serve(application, port=args.port)
@ -90,7 +90,7 @@ def command_run_webserver(args):
def command_run_task_queue(args): def command_run_task_queue(args):
print("Starting task queue.") print("Starting task queue.")
argv = [ argv = [
"--app=app",
"--app=config",
"--workdir={}".format(base), "--workdir={}".format(base),
"worker", "worker",
"--loglevel=info", "--loglevel=info",

backend/app/__init__.py → backend/config/__init__.py

backend/app/celery.py → backend/config/celery.py

@ -2,9 +2,9 @@ import os
from celery import Celery 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") app.config_from_object("django.conf:settings", namespace="CELERY")

backend/app/settings.py → backend/config/settings.py

@ -104,7 +104,7 @@ MIDDLEWARE = [
if DEBUG: if DEBUG:
MIDDLEWARE.append("api.middleware.RangesMiddleware") MIDDLEWARE.append("api.middleware.RangesMiddleware")
ROOT_URLCONF = "app.urls"
ROOT_URLCONF = "config.urls"
TEMPLATES = [ TEMPLATES = [
{ {
@ -136,7 +136,7 @@ STATICFILES_DIRS = [
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
WSGI_APPLICATION = "app.wsgi.application"
WSGI_APPLICATION = "config.wsgi.application"
AUTHENTICATION_BACKENDS = [ AUTHENTICATION_BACKENDS = [
"social_core.backends.github.GithubOAuth2", "social_core.backends.github.GithubOAuth2",

backend/app/urls.py → backend/config/urls.py

backend/app/wsgi.py → backend/config/wsgi.py

@ -11,6 +11,6 @@ import os
from django.core.wsgi import get_wsgi_application 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() application = get_wsgi_application()

2
backend/manage.py

@ -3,7 +3,7 @@ import os
import sys import sys
if __name__ == "__main__": if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
try: try:
from django.core.management import execute_from_command_line from django.core.management import execute_from_command_line
except ImportError as exc: except ImportError as exc:

2
docs/getting-started.md

@ -65,7 +65,7 @@ In another terminal, you need to run Celery to use import/export dataset feature
```bash ```bash
cd doccano/backend cd doccano/backend
celery --app=app worker --loglevel=INFO --concurrency=1
celery --app=config worker --loglevel=INFO --concurrency=1
``` ```
### Node.js ### Node.js

2
tools/dev-celery.sh

@ -8,5 +8,5 @@ cd "/src/backend"
python manage.py wait_for_db python manage.py wait_for_db
echo "Starting celery" 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
) )

2
tools/prod-celery.sh

@ -8,5 +8,5 @@ cd /backend
python manage.py wait_for_db python manage.py wait_for_db
echo "Starting celery" echo "Starting celery"
"celery" --app=app worker --loglevel=info --pool=solo
"celery" --app=config worker --loglevel=info --pool=solo
) )

2
tools/prod-django.sh

@ -25,4 +25,4 @@ if [[ -n "${ADMIN_USERNAME}" ]] && [[ -n "${ADMIN_PASSWORD}" ]] && [[ -n "${ADMI
fi fi
echo "Starting django" 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

6
tools/run.sh

@ -27,10 +27,10 @@ fi
echo "Starting django" 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}" 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="$!" gunicorn_pid="$!"
celery --app=app worker --loglevel=INFO --concurrency="${CELERY_WORKERS:-1}" &
celery --app=config worker --loglevel=INFO --concurrency="${CELERY_WORKERS:-1}" &
celery_pid="$!" celery_pid="$!"
while :; do while :; do
@ -43,4 +43,4 @@ while :; do
else else
sleep 10 sleep 10
fi fi
done
done
Loading…
Cancel
Save