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

collectstatic fails #1073

Closed
spechtx opened this issue Oct 13, 2021 · 9 comments · Fixed by #1076
Closed

collectstatic fails #1073

spechtx opened this issue Oct 13, 2021 · 9 comments · Fixed by #1076

Comments

@spechtx
Copy link

spechtx commented Oct 13, 2021

Hello everyone,

I might came across a potential issue with the azure functionality in django-storages in version 1.12.1.

Django's python manage.py collectstatic fails with following error:

azure.core.exceptions.ServiceRequestError: <urllib3.connection.HTTPSConnection object at 0x00000226A68C26D0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed

However the combination of the following works just fine, so i assume its not my settings, that cause the error:
django-storages==1.11.1
azure-storage-blob==2.1.0
azure-storage-common==2.1.0

Thanks :)

@campmap
Copy link

campmap commented Oct 14, 2021

I get the same error when uploading a file, works perfectly with v1.11.1, documentation does not show any obvious settings changes required between the two versions.
Upgrading the azure-storage-blob version is a great update but it seems like there is a bug.

@jschneier
Copy link
Owner

@pjsier @dimbleby would you mind looking at this? Azure is not something I really use and you touched it most recently.

@dimbleby
Copy link
Contributor

seems fairly unlikely to be related to my user-delegated-key contribution; but FWIW it all works for me...

getaddrinfo sounds like some sort of DNS failure, you should probably be looking at what you have going on round about here:

account_domain = self.custom_domain or "blob.core.windows.net"
account_url = "{}://{}.{}".format(
self.azure_protocol, self.account_name, account_domain
)

@pjsier
Copy link
Contributor

pjsier commented Oct 14, 2021

Unfortunately I haven't been working with this for a while, but this sounds familiar to the error described here https://stackoverflow.com/a/64600812 where the resources may not exist

@erol-hoke
Copy link

I am getting a similar error when running collectstatic however mine is:

azure.core.exceptions.ServiceRequestError: <urllib3.connection.HTTPSConnection object at 0x104cd9340>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known

I was following this tutorial:
https://medium.com/@DawlysD/django-using-azure-blob-storage-to-handle-static-media-assets-from-scratch-90cbbc7d56be

If anyone has any thoughts on what's going wrong I would really appreciate it.
Thanks

@dimbleby
Copy link
Contributor

dimbleby commented Oct 15, 2021

AZURE_CUSTOM_DOMAIN = f'{AZURE_ACCOUNT_NAME}.blob.core.windows.net'

looks not compatible with the current code. Try removing that altogether.

(It looks as though the Azure API no longer takes a custom domain in the place where it once did, and @pjsier's MR reinterpreted that configuration to mean something slightly different: you would now use that to replace 'blob.core.windows.net' rather than to configure the entire domain.)

@erol-hoke
Copy link

Thank you so much! That solved my problem.

@dimbleby
Copy link
Contributor

@pjsier this was probably a mis-step, I think? Suggest something like this would both restore the old behaviour, and make it possible to use truly custom domains:

-        account_domain = self.custom_domain or "blob.core.windows.net"
-        account_url = "{}://{}.{}".format(
-            self.azure_protocol, self.account_name, account_domain
+        account_domain = self.custom_domain or "{}.blob.core.windows.net".format(
+            self.account_name
         )
+        account_url = "{}://{}".format(self.azure_protocol, account_domain)

What do you think?

@pjsier
Copy link
Contributor

pjsier commented Oct 15, 2021

I think that makes sense! I was trying to mirror the API, but in this case I think it likely caused more issues than it solved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants