semvec/pypi-packages huggingface dataset:
ramos 1.4.0
Generic backend pool
Keywords: django backends pool

Ramos
=====

.. image:: https://travis-ci.org/luizalabs/ramos.svg?branch=master
    :target: https://travis-ci.org/luizalabs/ramos

.. image:: https://codecov.io/gh/luizalabs/ramos/branch/master/graph/badge.svg
    :target: https://codecov.io/gh/luizalabs/ramos


Generic backend pool


Setup
-----

.. code:: bash

    pip install ramos


Development setup
-----------------

.. code:: bash

    make install


Usage
-----

.. code:: python

    import ramos

    ramos.configure(pools={
        'backend_type': [
            'path.to.backend_a',
            'path.to.backend_b',
        ]
    })


Integrations
~~~~~~~~~~~~

Ramos can uses `Django`_ or `Simple Settings`_ to get backends
configurations if set settings.POOL_OF_RAMOS:

.. code:: python

    POOL_OF_RAMOS = {
        'backend_type': [
            'path.to.backend_a',
            'path.to.backend_b',
        ]
    }


Backend Implementations
~~~~~~~~~~~~~~~~~~~~~~~

.. code:: python

    from ramos.mixins import ThreadSafeCreateMixin


    class BackendA(ThreadSafeCreateMixin):
        id = 'backend_a'
        def say(self):
            return 'A'


    class BackendB(ThreadSafeCreateMixin):
        id = 'backend_b'
        def say(self):
            return 'B'


Backend Pool
~~~~~~~~~~~~

.. code:: python

    from ramos.pool import BackendPool


    class BackendTypePool(BackendPool)
        backend_type = 'backend_type'


    backends = BackendTypePool.all()

    for backend in backends:
        print(backend.say())


    # backend_a = BackendTypePool.get('backend_a')
    # backend_b = BackendTypePool.get('backend_b')

.. _Django: https://github.com/django/django
.. _Simple Settings: https://github.com/drgarcia1986/simple-settings
django-filestorages 0.1
Configurable file storages for Django

# django-filestorages

Django-getstorage is a tiny Python library for dealing with configurable
Django storages.

It allows you to define a dictionary of file storage configurations
in your `settings` and refer to them by name in your code.

It should be obsolete once [Django ticket 26029](https://code.djangoproject.com/ticket/26029)
is resolved.


## Installation

Use the package manager [pip](https://pip.pypa.io/en/stable/) to install django-filestorages.

```bash
pip install django-filestorages
```


## Usage

Wherever you need a storage, use the `filestorages.get_storage` function.

```python
from filestorages import get_storage

file = models.FileField(storage=get_storage('some.configured.storage'))
```


In your settings, you can define your storages using dotted paths:

```python
FILE_STORAGES = {
    'default': {
        'BACKEND': "django.core.files.storage.FileSystemStorage",
        'OPTIONS': {
            'location': '/path/to/the/files/',
            'base_url': '/files/',
        }
    },
    'some': {
        'BACKEND': 'other.backend.Storage',
        'OPTIONS': {
            'option': 'value',
        },
    },
    'some.configured': {
        'OPTIONS': {
            'second_option': True,
        },
    },
}
```

In this example `get_storage('some.configured.storage')` returns `other.backend.Storage(option='value', second_option=True)`

If no matching backend is found, `FILE_STORAGES['default']` is used, falling back on 
`DEFAULT_FILE_STORAGE` if not set.



## License
[MIT](https://choosealicense.com/licenses/mit/)