{ "info": { "author": "Tom Chiung-ting Chen", "author_email": "ctchen@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 1.11", "Framework :: Django :: 2.0", "Framework :: Django :: 2.1", "Framework :: Django :: 2.2", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", "Topic :: Internet :: WWW/HTTP" ], "description": "# DJ-Registry\nThis is a simple, easy access key-value registry for Django. Sometimes you would like to have some flexibility in your settings.\nPutting your settings in `settings.py` or as environment variables also mean an engineer familiar with code or command line is required to alter them.\n\nThis Django app leverage the built-in Django admin so changing settings is easier as you can use the web interface.\n\n## Requirements\n* Python 3\n* Django >= 1.11\n\nI only did a quick test with Python 3.6 on Django 1.11 and the latest Django, which is 2.2.6 at the time being.\n\n## Installation\n\nInstall DJ-Registry with your favorite Python package manager:\n\n```\n(venv)$ pip install dj_registry\n```\n\nAdd `registry` to your `INSTALLED_APPS` settings:\n\n```py\nINSTALLED_APPS = [\n # other apps...\n\n 'registry',\n]\n```\n\nMigrate the database\n\n```\n(venv)$ ./manage.py migrate\n```\n\nThen, we're all set!\n\n## Usage\n\nLog in to the admin, and create some keys under the **Django Registry** > **Entries** section. Let's say, we create `mailgun.key` and `mailgun.domain` with the corresponding `string` type and values.\nWe then create another entry with `game.max_score` as the key, `10000` as the value and `integer` as the type.\n\nThe following example shows you how to access them in code:\n\n```py\nfrom registry.helper import reg\n\nkey = reg['mailgun.key'] # the key that you set\ndomain = reg['mailgun.domain'] # the domain that you set\n\nmax_score = reg['game.max_score'] # 10000, it is returned as an int\n```\n\nYou can also use `get` if you want to have a default and avoid exceptions if the key is not available (not enabled or does not exist)\n\n```py\nreg.get('game.levels', 10) # return 10 if key not found or disabled\nreg['game.levels'] # KeyError if key not found or disabled\n```\n\nYou can set or delete entry if you want\n```py\nreg['game.levels'] = 12 # Set game.levels to 12 (integer) and save\ndel reg['game.levels'] # Delete game.levels\n```\n\n## Enabled and comment field\nIf you want to disable a key, just toggle the `enabled` boolean in the admin interface. It would be treated as if the key didn't exist. This is something meant to be used in the admin interface.\nIf you want to manipulate this in the code, you will have to access the raw model like the following:\n\n```py\nfrom registry.models import Entry\n\ne = Entry.objects.get('game.levels')\ne.enabled = False\ne.save()\n```\n\nThe comment field is also meant to be used in the admin interface. It is a convenient cell for user to put comments regarding to the settings, something like the following:\n\n```\n50: average use case.\n9999: maximum special case\n```\n\n## Types\n`integer`, `float`, and `string` are the supported types for now. There might be `boolean` in the future.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/yychen/dj-registry", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "dj-registry", "package_url": "https://pypi.org/project/dj-registry/", "platform": "", "project_url": "https://pypi.org/project/dj-registry/", "project_urls": { "Homepage": "https://github.com/yychen/dj-registry" }, "release_url": "https://pypi.org/project/dj-registry/0.1.dev1/", "requires_dist": null, "requires_python": ">=3", "summary": "A simple, easy access key-value registry for Django.", "version": "0.1.dev1" }, "last_serial": 5982204, "releases": { "0.1.dev1": [ { "comment_text": "", "digests": { "md5": "00d6861cc8482b5b921cdee47c65f70b", "sha256": "4581bf4b3fa5ebf60f80add837d89f6b08da72968cb7e4022f4d9a465dda615e" }, "downloads": -1, "filename": "dj_registry-0.1.dev1-py3-none-any.whl", "has_sig": false, "md5_digest": "00d6861cc8482b5b921cdee47c65f70b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 6756, "upload_time": "2019-10-16T09:30:32", "url": "https://files.pythonhosted.org/packages/59/52/14247256258fb211a3f27e1ee68e087f563696cd6d0b8a3f1b82cea980e9/dj_registry-0.1.dev1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1d3676f52a0d65bf942db0a0de1df799", "sha256": "89245dc3adae3f43e5ac2efbf63b387a1db6d82fd2e05642d05bbe3cf145fc23" }, "downloads": -1, "filename": "dj_registry-0.1.dev1.tar.gz", "has_sig": false, "md5_digest": "1d3676f52a0d65bf942db0a0de1df799", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 4613, "upload_time": "2019-10-16T09:30:35", "url": "https://files.pythonhosted.org/packages/9b/76/763faf85a99d1d700b277168b762bf86f036aadb1739164b0853db321355/dj_registry-0.1.dev1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "00d6861cc8482b5b921cdee47c65f70b", "sha256": "4581bf4b3fa5ebf60f80add837d89f6b08da72968cb7e4022f4d9a465dda615e" }, "downloads": -1, "filename": "dj_registry-0.1.dev1-py3-none-any.whl", "has_sig": false, "md5_digest": "00d6861cc8482b5b921cdee47c65f70b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 6756, "upload_time": "2019-10-16T09:30:32", "url": "https://files.pythonhosted.org/packages/59/52/14247256258fb211a3f27e1ee68e087f563696cd6d0b8a3f1b82cea980e9/dj_registry-0.1.dev1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1d3676f52a0d65bf942db0a0de1df799", "sha256": "89245dc3adae3f43e5ac2efbf63b387a1db6d82fd2e05642d05bbe3cf145fc23" }, "downloads": -1, "filename": "dj_registry-0.1.dev1.tar.gz", "has_sig": false, "md5_digest": "1d3676f52a0d65bf942db0a0de1df799", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 4613, "upload_time": "2019-10-16T09:30:35", "url": "https://files.pythonhosted.org/packages/9b/76/763faf85a99d1d700b277168b762bf86f036aadb1739164b0853db321355/dj_registry-0.1.dev1.tar.gz" } ] }