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
|
||||
media/
|
||||
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-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
|
||||
redis: redis-server
|
||||
rqworker: ./manage.py rqworker --with-scheduler
|
||||
|
|
1
justfile
1
justfile
|
@ -3,6 +3,7 @@ set dotenv-load
|
|||
# Load virtualenv
|
||||
export PATH := justfile_directory() + "/env/bin:" + env_var('PATH')
|
||||
export PYTHONUNBUFFERED := "true"
|
||||
export QUEUE_STORE_URL := "redis://localhost/0"
|
||||
|
||||
# Dev environment
|
||||
export DEBUG := "true"
|
||||
|
|
|
@ -8,3 +8,5 @@ lxml==4.9.0
|
|||
more-itertools==8.13.0
|
||||
requests==2.27.1
|
||||
wagtail-generic-chooser==0.4.1
|
||||
django-rq==2.5.1
|
||||
django-redis==5.2.0
|
||||
|
|
|
@ -45,6 +45,7 @@ INSTALLED_APPS = [
|
|||
"modelcluster",
|
||||
"taggit",
|
||||
"generic_chooser",
|
||||
"django_rq",
|
||||
"django.contrib.admin",
|
||||
"django.contrib.auth",
|
||||
"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")}
|
||||
|
||||
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
|
||||
# https://docs.djangoproject.com/en/4.0/topics/i18n/
|
||||
|
|
|
@ -22,6 +22,7 @@ urlpatterns = [
|
|||
ServeView.as_view(action="redirect"),
|
||||
name="wagtailimages_serve",
|
||||
),
|
||||
path("django-rq/", include("django_rq.urls")),
|
||||
]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue