-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic multiple beanstalkd support
- Loading branch information
1 parent
0b0b817
commit 76f94f4
Showing
5 changed files
with
63 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from django.conf import settings | ||
|
||
class Middleware(object): | ||
def process_request(self, request): | ||
if 'conn' not in request.COOKIES: | ||
return | ||
|
||
conn_id = int(request.COOKIES['conn']) | ||
request.connection = settings.BEANSTALK_SERVERS[conn_id] | ||
|
||
def ContextProcessor(request): | ||
if 'conn' not in request.COOKIES: | ||
conn_id = None | ||
else: | ||
conn_id = int(request.COOKIES['conn']) | ||
return {'connections':settings.BEANSTALK_SERVERS,'conn_id':conn_id} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,9 +22,6 @@ | |
} | ||
} | ||
|
||
BEANSTALK_HOST = 'localhost' | ||
BEANSTALK_PORT = 11300 | ||
|
||
LOGIN_REDIRECT_URL = '/' | ||
|
||
FLASH_IGNORE_MEDIA = True | ||
|
@@ -101,6 +98,15 @@ | |
'beanstalk', | ||
) | ||
|
||
### MULTIPLE BEANSTALKD SUPPORT | ||
BEANSTALK_SERVERS = ( | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
modsaid
|
||
) | ||
from django.conf import global_settings | ||
MIDDLEWARE_CLASSES += ('beanstalk.multiple_beanstalk.Middleware',) | ||
TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + ( | ||
'beanstalk.multiple_beanstalk.ContextProcessor', | ||
) | ||
|
||
try: | ||
from local_settings import * | ||
except ImportError: | ||
|
What is the expected format of the servers to pass here?
is it "localhost:11300" for example?. or ['localhost','11300']? or what?