File tree Expand file tree Collapse file tree 3 files changed +7
-9
lines changed Expand file tree Collapse file tree 3 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,6 @@ Installation
50
50
' high' : {
51
51
' URL' : os.getenv(' REDISTOGO_URL' , ' redis://localhost:6379/0' ), # If you're on Heroku
52
52
' DEFAULT_TIMEOUT' : 500 ,
53
- ' EXCEPTION_HANDLERS' : [' path.to.my.handler' ], # If you need custom exception handlers
54
53
},
55
54
' low' : {
56
55
' HOST' : ' localhost' ,
@@ -59,6 +58,8 @@ Installation
59
58
}
60
59
}
61
60
61
+ RQ_EXCEPTION_HANDLERS = [' path.to.my.handler' ] # If you need custom exception handlers
62
+
62
63
* Include ``django_rq.urls `` in your ``urls.py ``:
63
64
64
65
.. code-block :: python
Original file line number Diff line number Diff line change 17
17
QUEUES_LIST .append ({'name' : key , 'connection_config' : value })
18
18
for config in get_unique_connection_configs ():
19
19
QUEUES_LIST .append ({'name' : 'failed' , 'connection_config' : config })
20
+
21
+ # Get exception handlers
22
+ EXCEPTION_HANDLERS = getattr (settings , 'RQ_EXCEPTION_HANDLERS' , [])
Original file line number Diff line number Diff line change 1
- from django .conf import settings
2
-
3
1
from rq import Worker
4
2
from rq .utils import import_attribute
5
3
6
4
from .queues import get_queues
5
+ from .settings import EXCEPTION_HANDLERS
7
6
8
7
9
8
def get_exception_handlers ():
@@ -13,12 +12,7 @@ def get_exception_handlers():
13
12
'EXCEPTION_HANDLERS': ['path.to.handler'],
14
13
}
15
14
"""
16
- RQ = getattr (settings , 'RQ' , {})
17
- exception_handlers = []
18
- for path in RQ .get ('EXCEPTION_HANDLERS' , []):
19
- handler = import_attribute (path )
20
- exception_handlers .append (handler )
21
- return exception_handlers
15
+ return [import_attribute (path ) for path in EXCEPTION_HANDLERS ]
22
16
23
17
24
18
def get_worker (* queue_names ):
You can’t perform that action at this time.
0 commit comments