Using azure as a repository for Django (using django repositories)

I use the django repositories that I used in the past to work with AWS S3. But with Microsoft Azure, I run into errors that do not return any results in google.

I am developing using python 3 and Django 1.8.4. I am using django-storage and django-storageages-redux to support python 3.

When calling ./manage.py collectstatic and type yes I get two (!) Errors:

 Traceback (most recent call last): File "/Users/mac/.virtualenvs/bratwurst/lib/python3.4/site-packages/storages/backends/azure_storage.py", line 44, in exists self.connection.get_blob_properties( File "/Users/mac/.virtualenvs/bratwurst/lib/python3.4/site-packages/storages/backends/azure_storage.py", line 34, in connection self._connection = azure.storage.BlobService( AttributeError: 'module' object has no attribute 'BlobService' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "./manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/Users/mac/.virtualenvs/bratwurst/lib/python3.4/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line utility.execute() File "/Users/mac/.virtualenvs/bratwurst/lib/python3.4/site-packages/django/core/management/__init__.py", line 330, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Users/mac/.virtualenvs/bratwurst/lib/python3.4/site-packages/django/core/management/base.py", line 393, in run_from_argv self.execute(*args, **cmd_options) File "/Users/mac/.virtualenvs/bratwurst/lib/python3.4/site-packages/django/core/management/base.py", line 444, in execute output = self.handle(*args, **options) File "/Users/mac/.virtualenvs/bratwurst/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 168, in handle collected = self.collect() File "/Users/mac/.virtualenvs/bratwurst/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 107, in collect handler(path, prefixed_path, storage) File "/Users/mac/.virtualenvs/bratwurst/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 305, in copy_file if not self.delete_file(path, prefixed_path, source_storage): File "/Users/mac/.virtualenvs/bratwurst/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 218, in delete_file if self.storage.exists(prefixed_path): File "/Users/mac/.virtualenvs/bratwurst/lib/python3.4/site-packages/storages/backends/azure_storage.py", line 46, in exists except azure.WindowsAzureMissingResourceError: AttributeError: 'module' object has no attribute 'WindowsAzureMissingResourceError' 

I followed the meager instructions for using django repositories with azure here .

Any idea what might cause this error? Has anyone successfully deployed django 1.8 application with azure as storage and static files?

edit: I hacked a little django-storage module: Using

 import azure.storage.blob self._connection = azure.storage.blob.blobservice.BlobService( 

instead

 self._connection = azure.storage.BlobService( 

But now I get various errors that make me believe that this problem actually goes deeper.

+2
source share
2 answers

I found a problem:

django-storages-redux is just outdated and incompatible with the latest version of azure sdk

a request to download the author is in progress:

https://github.com/jschneier/django-storages/pull/86

I made my own quickfix here:

https://github.com/schumannd/django-storages

+2
source

Because you use a storage platform on top of our storage library, our support may be limited. It looks like there have been changes in the restructuring and renaming of parts of the python client library and the Azure-Storage platform you are using, which has not updated their snap-in. Others also had problems using this platform. See the following question filed against Django repositories:
https://bitbucket.org/david/django-storages/issues/225/azure-storages-are-incorrectly-imported

Looking at the backend file for your Django solution seems to give you very little convenience in using our repository directly. You might want to use our library, as it will provide you maximum flexibility when storing data. If you prefer to use Django repositories, you can contact them and see if they will fix it or unlock their code base and fix the problem themselves. You can see all the work we do to improve this library here: https://github.com/Azure/azure-storage-python/tree/dev

Thanks!

0
source

Source: https://habr.com/ru/post/1238133/


All Articles