Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix upload .qgz project file #544

Merged
merged 5 commits into from
May 5, 2023
Merged

Fix upload .qgz project file #544

merged 5 commits into from
May 5, 2023

Conversation

wlorenzetti
Copy link
Member

Fix reading .qgz QGIS project file on create new one or update.

Closes: #543

@wlorenzetti wlorenzetti added the bug Something isn't working label May 4, 2023
@wlorenzetti wlorenzetti self-assigned this May 4, 2023
@wlorenzetti
Copy link
Member Author

This PR fix also this: #542 (comment)

@wlorenzetti wlorenzetti marked this pull request as ready for review May 4, 2023 13:45
@wlorenzetti
Copy link
Member Author

@volterra79 can you check it ASAP? Thanks.

@Raruto
Copy link
Contributor

Raruto commented May 4, 2023

I tried to test this pull following the steps of #480, but i get the following:

image

Request Headers

PATCH /en/dff/upload/4045ccf2-04b9-454d-b1f6-5b19d6ffc58a HTTP/1.1
Host: localhost:8000
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/112.0
Accept: */*
Accept-Language: en-US,it-IT;q=0.7,it;q=0.3
Accept-Encoding: gzip, deflate, br
Referer: http://localhost:8000/en/admin/qdjango/buildings/projects/update/public-building-management-demo/
Tus-Resumable: 1.0.0
Upload-Offset: 0
Content-Type: application/offset+octet-stream
X-CSRFToken: FIbazIZUXaosGaDovA49kXdvWuZm7rv18ImeLM6IhKkkHrNkO1QBcxbZ02MNjCV2
Content-Length: 1226140
Origin: http://localhost:8000
DNT: 1
Connection: keep-alive
Cookie: csrftoken=RnBK4NIE797RHumldI07n3Uwzg6NJRLmknMOgRPsrJ3JILwhw9MzfDS0DOTeV2bn; gi3w-suite-dev-iehtgdb264t5gr=n93mb99nsu1zayg5t34pzf1mw0w8fnyg; cookieconsent_status=dismiss; g3wclientsessiontoken=427fcd13031448ba9b07f12e87bc135a
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
Pragma: no-cache
Cache-Control: no-cache

Response Headers

HTTP/1.1 410 Gone
Server: gunicorn
Date: Thu, 04 May 2023 14:12:25 GMT
Connection: close
Content-Type: text/html; charset=utf-8
Tus-Resumable: 1.0.0
Tus-Version: 1.0.0
Tus-Extension: creation,termination,file-check
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: PATCH,HEAD,GET,POST,OPTIONS
Access-Control-Expose-Headers: Tus-Resumable,upload-length,upload-metadata,Location,Upload-Offset
Access-Control-Allow-Headers: Tus-Resumable,upload-length,upload-metadata,Location,Upload-Offset,content-type
Cache-Control: no-store
X-Frame-Options: DENY
Content-Length: 0
Content-Language: en
X-Content-Type-Options: nosniff
Referrer-Policy: same-origin
Vary: Origin
Access-Control-Allow-Credentials: true

@wlorenzetti
Copy link
Member Author

This issue is related to django-file-form and caching problem (http://mbraak.github.io/django-file-form/details/)

Local-memory caching

Don't use local-memory caching in your Django configuration if you use a multi process WSGI server. It will break file uploads, because file uploads use the Django cache and might hit different WSGI processes.

The default cache option in Django is local-memory caching.

Most WSGI servers are multi process.

Infact for production deploy I add django-redis module and move caching backend on redis g3w-suite/g3w-suite-docker#96.

So because you use docker for delveloping I suggest to use redis as caching system or to pull down the gunicorn workers to 1.

@wlorenzetti wlorenzetti merged commit d2e4ec7 into dev May 5, 2023
4 checks passed
@wlorenzetti wlorenzetti deleted the Fix_issue_543 branch May 5, 2023 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error on upload .qgz QGIS project file
3 participants