django-lazy-services
A helper for switching between test and production versions of a service
Purpose
Lets you easily switch between versions of a service based on a Django setting entry.
Good for situations where you want to use different versions between production and development and/or test.
In the client code you might use: from . import my_service which might go to either .services.MyService or .services.MyFakeService depending on the content of your settings.
Usage
Construct your service as a class whose init takes no arguments.
In services.py:
class MyService:
def __init__(self):
pass
def hello(self):
print("hello world")
Declare the service.
In __init__.py:
from lazy_services import LazyService
my_service = LazyService("MY_SERVICE")
Select the service.
In settings.py
MY_SERVICE = "my_project.services.MyService"
Use the service.
from . import my_serivce
my_service.hello()
Metadata
Release files for django-lazy-services 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-lazy-services-0.0.3.tar.gz | 1.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_lazy_services-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.0 kB
Release files / django-lazy-services-0.0.3.tar.gz
| Download URL | django-lazy-services-0.0.3.tar.gz |
|---|---|
| Size | 1.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2a4b52e1c354125306033bf3b34b9481c8ed44764376709310c59986144b20bb
|
|
BLAKE2b-256 checksum How to use checksums |
87d137cca1db0276ba7e0dc02a673f18fa3068bb172b2d18c4150289924fee22
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
|
Release files / django_lazy_services-0.0.3-py3-none-any.whl
| Download URL | django_lazy_services-0.0.3-py3-none-any.whl |
|---|---|
| Size | 3.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6bfe8fce78488dabd8c4141eb76d2a6b04095ed01e74fb8006290a0bfbda042f
|
|
BLAKE2b-256 checksum How to use checksums |
7caf913088070990f49c7e1a62ea4c59df99c8181ab571fc9cde02185ae5e6e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
|