-
-
Save thenewguy/d65418957dda538cb99a246b172ce02a to your computer and use it in GitHub Desktop.
Serve celery flower behind Django authentication.
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
celery flower --address=127.0.0.1 --url_prefix=flower --broker=<broker url> |
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
location /rewolf/ { | |
internal; | |
rewrite ^/rewolf/(.*)$ /$1 break; | |
proxy_pass http://127.0.0.1:5555; | |
proxy_set_header Host $host; | |
} | |
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
from django.conf.urls import patterns, include, url | |
urlpatterns = patterns( | |
'', | |
url(r'^flower/', 'internal.views.flower_view'), | |
) | |
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
from django.http import HttpResponse | |
from django.contrib.auth.decorators import user_passes_test | |
@user_passes_test(lambda u: u.is_staff) | |
def flower_view(request): | |
response = HttpResponse() | |
path = request.get_full_path() | |
path = path.replace('flower', 'rewolf', 1) | |
response['X-Accel-Redirect'] = path | |
return response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment