Add RQ
This commit is contained in:
parent
70b08137bc
commit
310de1acf8
6 changed files with 18 additions and 0 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -306,3 +306,6 @@ cython_debug/
|
||||||
/collected-static
|
/collected-static
|
||||||
media/
|
media/
|
||||||
django-cache/
|
django-cache/
|
||||||
|
|
||||||
|
# Redis
|
||||||
|
dump.rdb
|
||||||
|
|
2
Procfile
2
Procfile
|
@ -2,3 +2,5 @@ web: ./manage.py runserver
|
||||||
watch-js: npm run build:js -- --watch
|
watch-js: npm run build:js -- --watch
|
||||||
watch-css: npm run build:css -- --watch
|
watch-css: npm run build:css -- --watch
|
||||||
watch-contrib: ./scripts/copy-npm-contrib.sh; while inotifywait -e modify ./scripts/copy-npm-contrib.sh; do ./scripts/copy-npm-contrib.sh; done
|
watch-contrib: ./scripts/copy-npm-contrib.sh; while inotifywait -e modify ./scripts/copy-npm-contrib.sh; do ./scripts/copy-npm-contrib.sh; done
|
||||||
|
redis: redis-server
|
||||||
|
rqworker: ./manage.py rqworker --with-scheduler
|
||||||
|
|
1
justfile
1
justfile
|
@ -3,6 +3,7 @@ set dotenv-load
|
||||||
# Load virtualenv
|
# Load virtualenv
|
||||||
export PATH := justfile_directory() + "/env/bin:" + env_var('PATH')
|
export PATH := justfile_directory() + "/env/bin:" + env_var('PATH')
|
||||||
export PYTHONUNBUFFERED := "true"
|
export PYTHONUNBUFFERED := "true"
|
||||||
|
export QUEUE_STORE_URL := "redis://localhost/0"
|
||||||
|
|
||||||
# Dev environment
|
# Dev environment
|
||||||
export DEBUG := "true"
|
export DEBUG := "true"
|
||||||
|
|
|
@ -8,3 +8,5 @@ lxml==4.9.0
|
||||||
more-itertools==8.13.0
|
more-itertools==8.13.0
|
||||||
requests==2.27.1
|
requests==2.27.1
|
||||||
wagtail-generic-chooser==0.4.1
|
wagtail-generic-chooser==0.4.1
|
||||||
|
django-rq==2.5.1
|
||||||
|
django-redis==5.2.0
|
||||||
|
|
|
@ -45,6 +45,7 @@ INSTALLED_APPS = [
|
||||||
"modelcluster",
|
"modelcluster",
|
||||||
"taggit",
|
"taggit",
|
||||||
"generic_chooser",
|
"generic_chooser",
|
||||||
|
"django_rq",
|
||||||
"django.contrib.admin",
|
"django.contrib.admin",
|
||||||
"django.contrib.auth",
|
"django.contrib.auth",
|
||||||
"django.contrib.contenttypes",
|
"django.contrib.contenttypes",
|
||||||
|
@ -94,6 +95,14 @@ DATABASES = {"default": env.db(default=f"sqlite:///{BASE_DIR}/db.sqlite3")}
|
||||||
|
|
||||||
CACHES = {"default": env.cache(default=f"filecache:///{BASE_DIR}/django-cache")}
|
CACHES = {"default": env.cache(default=f"filecache:///{BASE_DIR}/django-cache")}
|
||||||
|
|
||||||
|
RQ_QUEUES = {}
|
||||||
|
|
||||||
|
USE_REDIS_QUEUE = False
|
||||||
|
if queue_store := env.cache("QUEUE_STORE_URL", default=None):
|
||||||
|
CACHES["rq"] = queue_store
|
||||||
|
USE_REDIS_QUEUE = True
|
||||||
|
RQ_QUEUES["default"] = {"USE_REDIS_CACHE": "rq"}
|
||||||
|
|
||||||
|
|
||||||
# Internationalization
|
# Internationalization
|
||||||
# https://docs.djangoproject.com/en/4.0/topics/i18n/
|
# https://docs.djangoproject.com/en/4.0/topics/i18n/
|
||||||
|
|
|
@ -22,6 +22,7 @@ urlpatterns = [
|
||||||
ServeView.as_view(action="redirect"),
|
ServeView.as_view(action="redirect"),
|
||||||
name="wagtailimages_serve",
|
name="wagtailimages_serve",
|
||||||
),
|
),
|
||||||
|
path("django-rq/", include("django_rq.urls")),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue