Skip to main content

Django storage for SoftLayer Cloud Storage

This package uses django-cumulus (https://pypi.python.org/pypi/django-cumulus) and softlayer-object-storage-python (https://pypi.python.org/pypi/softlayer-object-storage).

Link to github repository: https://github.com/Arpaso/django-softlayer

Settings

Add the following to your project’s settings.py (your SoftLayer credentials):

CUMULUS = {
    'USERNAME': 'YourUsername', # your SoftLayer user name
    'API_KEY': 'YourAPIKey',    # SoftLayer api key
    'CONTAINER': 'ContainerName' # SoftLayer container(folder) name
    'NETWORK': 'private', # Paid 'private' or free 'public' network is available
}

CLOUD_FILE_STORAGE = 'django_softlayer.SoftLayerStorage'
INSTALLED_APPS = [
    ...
    'django_softlayer',
    ...
]

Usage

To use this storage:

  • import storage class, and create your own storage.py:

    from django_softlayer import SoftLayerStorage
    from django.utils.functional import LazyObject
    from django.conf import settings
    
    class MyStorage(LazyObject):
        def _setup(self):
            self._wrapped = get_storage_class(settings.CLOUD_FILE_STORAGE)()
  • Then you can use it in models.py:

    from storage import MyStorage
    
    class MyModel(Model):
        file = models.FileField(storage=MyStorage())
  • That’s all.

To upload files to storage from folder, check for the command usage:

./manage.py syncstatic --help

Testing

To run tests:

./manage.py test django_softlayer

Management commands

syncstatic

Uploads directories to the cloud storage saving directory structure:

python manage.py syncstatic

Options

  1. –mediaroot - A source directory to copy files from, e.g. “/home/djangoprojects/myproject/media”. Defaults to settings.MEDIA_ROOT.

  2. –noreplace - Skip and do not replace existing files in the storage. Default is False.

  3. –mask - A file mask, e.g. *.ext. Defaults to: *.mp3

  4. -v - higher verbosity is available

get_missing_files

Prints information to console about empty or non existing files present in database but not at cloud files storage:

python manage.py get_missing_files

Options

–app_model_field - String containing dot separated app, model and field name. Example: myapp.User.file

NOTE: this options can be defaulted to CMD_MISSING_FILES_SETTINGS variable in settings.py:

CMD_MISSING_FILES_SETTINGS = (
    'app.model.filefield',
    'nextapp.nextmodel.nextfile'
)
  • When CMD_MISSING_FILES_SETTINGS variable is in settings.py, you can search a set of app.model.field to search for empty files.

  • When using –app_model_field option, you can only specify one app.model.field per command.

Written by the development team of Arpaso company: http://arpaso.com

Metadata

Release files for django-softlayer 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-softlayer 0.2
File Size Uploaded Provenance Actions
django-softlayer-0.2.tar.gz 1.0 MB Without provenance Details for django-softlayer-0.2.tar.gz

Release files / django-softlayer-0.2.tar.gz

Download URL django-softlayer-0.2.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
961892f3f9cad209e8eca16d448ef578f822cdc6696b1867d720f8e6e2d31ff7
BLAKE2b-256 checksum
How to use checksums
98a8c02d988e7e2196c36a4e5142760eaba57d6ddc90d230fefb6928ad36f4a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-softlayer 0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page