Generic backend pool
Project description
Generic backend pool for Django
Setup
pip install ramos
Development setup
make install
Usage
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:
POOL_OF_RAMOS = {
'backend_type': [
'path.to.backend_a',
'path.to.backend_b',
]
}
Backend Implementations
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
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')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ramos-1.2.0.tar.gz
(3.4 kB
view hashes)
Built Distribution
Close
Hashes for ramos-1.2.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e64082763cf065ac8566777a72da9b5a1a98547d2e42673c2a5213687949ce44 |
|
MD5 | da8857c914b80b9ca3f74484760bc9cb |
|
BLAKE2b-256 | 41f2dcdb515e38f55d0c83828b0119d8437d3bc14aa47a6057aee7fc8d09f590 |