|
| 1 | +# dj-inmemorystorage |
| 2 | + |
| 3 | +[](https://travis-ci.org/waveaccounting/dj-inmemorystorage) |
| 4 | + |
| 5 | +An in-memory data storage backend for Django. |
| 6 | + |
| 7 | +Compatible with Django's [storage |
| 8 | +API](https://docs.djangoproject.com/en/dev/ref/files/storage/). |
| 9 | + |
| 10 | +# Supported Versions |
| 11 | + |
| 12 | + - Python 2.7 with Django 1.11 |
| 13 | + - Python 3.5/3.6/3.7 with Django 1.11+ |
| 14 | + - Python 3.8 with Django 2.2+ |
| 15 | + |
| 16 | +In general, we follow [Python's supported |
| 17 | +versions](https://devguide.python.org/#status-of-python-branches) and |
| 18 | +[Django's supported |
| 19 | +versions](https://docs.djangoproject.com/en/dev/faq/install/#what-python-version-can-i-use-with-django). |
| 20 | +Any major change in version support will be released as a new major |
| 21 | +version. |
| 22 | + |
| 23 | +# Usage |
| 24 | + |
| 25 | +In your test settings file, add |
| 26 | + |
| 27 | +``` python |
| 28 | +DEFAULT_FILE_STORAGE = 'inmemorystorage.InMemoryStorage' |
| 29 | +``` |
| 30 | + |
| 31 | +By default, the `InMemoryStorage` backend is non-persistant, meaning |
| 32 | +that writes to it from one section of your code will not be present when |
| 33 | +reading from another section of your code, unless both are sharing the |
| 34 | +same instance of the storage backend. |
| 35 | + |
| 36 | +If you need your storage to persist, you can add the following to your |
| 37 | +settings. |
| 38 | + |
| 39 | +``` python |
| 40 | +INMEMORYSTORAGE_PERSIST = True |
| 41 | +``` |
| 42 | + |
| 43 | +# Differences |
| 44 | + |
| 45 | +This library is based on |
| 46 | +[django-inmemorystorage](https://github.com/codysoyland/django-inmemorystorage) |
| 47 | +by Cody Soyland, with |
| 48 | +[modifications](https://github.com/SeanHayes/django-inmemorystorage) |
| 49 | +made by Seán Hayes with support for the `url` method, with [additional |
| 50 | +support](https://github.com/Vostopia/django-inmemorystorage) from Tore |
| 51 | +Birkeland for writing to the file. |
| 52 | + |
| 53 | +Wave's modifications include packaging, and test modifications such that |
| 54 | +`python setup.py test` works. This version also bumps the version to |
| 55 | +`1.0.0` and renames it to dj-inmemorystorage such that it doesn't |
| 56 | +conflict on PyPI. |
| 57 | + |
| 58 | +The biggest difference is that this package works with Django 1.4 now |
| 59 | +(previously only 1.5+). It also supports Python 2.6/2.7 with Django |
| 60 | +1.4+, Python 3.2/3.3/3.4 with Django 1.5+ and Python 3.5/3.6 with Django |
| 61 | +1.7+. |
| 62 | + |
| 63 | +# Contributing |
| 64 | + |
| 65 | +1. Ensure that you open a pull request |
| 66 | +2. All feature additions/bug fixes MUST include tests |
0 commit comments