- Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
When the url has some querystring like:
http://domain.com/path/to/view/?query=some%40mail.com
django wait to receive this:
def some_view(request): query = request.GET.get('query') assert query == 'some@mail.com'with Zappa 0.51.0 and Django 3.0.5 and python 3.7 on Lambda and ALB
this is the actual behavior
def some_view(request): query = request.GET.get('query') assert query == 'some%40mail.com'So I made this small middleware to quick fix:
class FixQueryStringZappaMiddleware: def __init__(self, get_response): self.get_response = get_response def __call__(self, request): if os.envirion('FRAMEWORK') == 'Zappa': querystring = request.GET.urlencode() u = urllib.parse.unquote(querystring) request.GET = QueryDict(u) response = self.get_response(request) return responseand add this middleware as first of your list of middlewares
this is my zappa_settings.json
{ "project": { "project_name": "project-backend", "aws_region": "sa-east-1", "alb_enabled": true, "apigateway_enabled": false, "cors": true, "keep_warm": false, "touch": false, "runtime": "python3.7", "timeout_seconds": 900, "log_level": "INFO", "s3_bucket": "some-bucket", "delete_s3_zip": false, "debug": true } }Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels