{ "info": { "author": "Jaakko Kantoj\u00e4rvi", "author_email": "jaakko@n-1.fi", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 1.10", "Framework :: Django :: 1.11", "Framework :: Django :: 1.9", "Framework :: Django :: 2.0", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3 :: Only", "Topic :: Software Development :: Build Tools", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Essential Django utilities from Raphendyr\n=========================================\n\nFew essential additions for working with Django web framework.\nIn other words, stuff I have always copied to every project I have been working with.\n\n\nSetting management\n------------------\n\nModule :code:`conf` contains tools to hwlp working with django :code:`settings.py`.\nMost important parts are including :code:`local_settings.py` and creating :code:`SECRET_KEY` in :code:`secret_key.py`.\nIn addition, environment variables starting with :code:`DJANGO_` will be included (parsed as json) to overwrite settings (useful for heroku for example).\n\nIn end of your :code:`settings.py` add following:\n\n.. code-block:: python\n\n from r_django_essentials.conf import update_settings\n update_settings(__name__)\n\nThat is basically same as:\n\n.. code-block:: python\n\n from r_django_essentials.conf import *\n\n # second argument is optional for all except firts. Default is shown here.\n update_settings_from_module(__name__, 'local_settings')\n update_secret_from_file(__name__, 'secret_key')\n update_settings_from_environment(__name__, 'DJANGO_')\n update_installed_apps(__name__, 'required_apps')\n update_context_processors_from_apps(__name__, 'context_processors')\n use_cache_template_loader_in_production(__name__)\n\nConsult the :code:`conf.py` for more details.\n\n\nSecret key autogeneration\n-------------------------\n\nEvery installation of your application should always use it's own randomly generated :code:`SECRET_KEY`.\nTo help with this task you can use this feature to automatically create new key if one is not provided by the settings.\n\nFor this feature to work, your :code:`settings.py` needs to do one of the following:\n\n.. code-block:: python\n\n # Include SECRET_KEY from secret_key.py into settings\n from r_django_essentials.conf import update_secret_from_file\n update_secret_from_file(__name__, 'secret_key')\n\n.. code-block:: python\n\n # update_settings will call above function as part of it's work\n from r_django_essentials.conf import update_settings\n update_settings(__name__)\n\nThis will load the option if the file exists and will create new file if one doesn't exist.\n\nRemember to add :code:`myproject/secret_key.py` to :code:`.gitignore` as you shouldn't ever have :code:`SECRET_KEY` in your version control.\n\n\nDjango app dependencies\n-----------------------\n\nDjango doesn't support depending from another Django app, but that is still sometimes really useful.\nTo keep power for the web app maintainer, don't abuse this system my including complex django apps.\nThis feature is best used to include template and asset libraries (distributed ass django apps).\n\nFor this feature to work, your :code:`settings.py` needs to do one of the following:\n\n.. code-block:: python\n\n # Just expand the apps dependencies\n from r_django_essentials.conf import expand_required_apps\n INSTALLED_APPS = expand_required_apps(INSTALLED_APPS)\n\n.. code-block:: python\n\n # Do same as above, but manipulate settings module\n from r_django_essentials.conf import update_installed_apps\n update_installed_apps(__name__)\n\n.. code-block:: python\n\n # update_settings will call above function as part of it's work\n from r_django_essentials.conf import update_settings\n update_settings(__name__)\n\nNow that :code:`settings.py` is calling correct functions, you need to add something like following to your apps :code:`AppConfig`:\n\n.. code-block:: python\n\n # myapp/apps.py\n from django.apps import AppConfig\n\n class MyAppConfig(AppConfig):\n name = 'myapp'\n verbose_name = 'My example app'\n\n required_apps = [\n 'django.contrib.staticfiles',\n 'django.contrib.humanize',\n ]\n\nThose apps will be added to :code:`INSTALLED_APPS` by one of the above settings snippets.\n\n\nRequired context processors\n---------------------------\n\nSimilar to app dependencies, this feature populates template engines :code:`context_processors` list from :code:`AppConfig`.\n\nFor this feature to work, your :code:`settings.py` needs to do one of the following:\n\n.. code-block:: python\n\n # Just update TEMPLATES list of dictionaries\n from r_django_essentials.conf import add_required_context_processors\n add_required_context_processors(TEMPLATES, INSTALLED_APPS)\n\n.. code-block:: python\n\n # Do same as above, but manipulate settings module\n from r_django_essentials.conf import update_context_processors_from_apps\n update_context_processors_from_apps(__name__)\n\n.. code-block:: python\n\n # update_settings will call above function as part of it's work\n from r_django_essentials.conf import update_settings\n update_settings(__name__)\n\nIn your apps :code:`AppConfig` you would have something like this:\n\n.. code-block:: python\n\n # myapp/apps.py\n from django.apps import AppConfig\n\n class MyAppConfig(AppConfig):\n name = 'myapp'\n verbose_name = 'My example app'\n\n context_processors = 'myapp.context_processors.myapp_context_processor' \n # or\n context_processors = (\n 'myapp.context_processors.myapp_context_processor1',\n 'myapp.context_processors.myapp_context_processor2',\n )\n\nAbove will add context processors into django template engines options.\nIf you need to add context processors for different backend,\nthen use dictionary with backend as a key and list of processors as value.\n\n\nDeprecated warning\n------------------\n\nNeed to mark function deprecated without good deprecation system in place?\n\n.. code-block:: python\n\n from r_django_essentials.deprecation import deprecated\n\n @deprecated(\"my_function is deprecated, use my_new_function instead\")\n def my_function(argument):\n return my_new_function(argument)\n\n\nColorized log formatter\n-----------------------\n\nYou would like to color code different log sources with different colors?\n\nIn your :code:`settings.py`:\n\n.. code-block:: python\n\n OGGING = {\n 'version': 1,\n 'disable_existing_loggers': False,\n 'formatters': {\n 'colored': {\n '()': 'r_django_essentials.logging.SourceColorizeFormatter',\n 'format': '[%(asctime)s: %(levelname)8s %(name)s] %(message)s',\n 'colors': {\n 'django.db.backends': {'fg': 'cyan'},\n 'myapp': {'fg': 'red'},\n },\n },\n },\n 'handlers': {\n 'debug_console': {\n 'level': 'DEBUG',\n 'class': 'logging.StreamHandler',\n 'stream': 'ext://sys.stdout',\n 'formatter': 'colored',\n },\n },\n 'loggers': {\n '': {\n 'level': 'DEBUG',\n 'handlers': ['debug_console'],\n 'propagate': True\n },\n },\n }\n\n\nEnum for choices in models\n--------------------------\n\nEasily create enumerations that works well with choices field in django.\n\nIn your :code:`models.py`:\n\n.. code-block:: python\n\n from django.db import models\n from django.utils.translation import ugettext_lazy as _\n from r_django_essentials.fields import Enum\n\n class MyProcess(models.Model):\n STATUS = Enum(\n ('OK', 0, _('Process is ok')),\n ('PROBLEM', 1, _('Process has problem')),\n ('ERROR', 2, _('Process is in error state')),\n )\n\n status = models.PositiveSmallIntegerField(\n default=STATUS.OK,\n choices=STATUS.choices,\n verbose_name=_(\"Process status\"),\n )\n\n @property\n def status_text(self):\n return self.STATUS[self.status]\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/raphendyr/raphendyr-django-essentials", "keywords": "django", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "raphendyr-django-essentials", "package_url": "https://pypi.org/project/raphendyr-django-essentials/", "platform": "", "project_url": "https://pypi.org/project/raphendyr-django-essentials/", "project_urls": { "Homepage": "https://github.com/raphendyr/raphendyr-django-essentials" }, "release_url": "https://pypi.org/project/raphendyr-django-essentials/1.3.0/", "requires_dist": null, "requires_python": "", "summary": "Some essential tools when working with any Django project", "version": "1.3.0" }, "last_serial": 4004110, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "04bc83f2c8b85d021f73a3f1e08ad8c0", "sha256": "112afcfb0e0c443c6ab732ded6465e8ee48ebd926cff0be436a783a7d01f325f" }, "downloads": -1, "filename": "raphendyr-django-essentials-1.0.0.tar.gz", "has_sig": false, "md5_digest": "04bc83f2c8b85d021f73a3f1e08ad8c0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12163, "upload_time": "2017-07-04T19:59:05", "url": "https://files.pythonhosted.org/packages/53/f7/81f142b61f2fc3323efe77cad01f1d38e9cba51076f6ac67d3c6a3de87a1/raphendyr-django-essentials-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "ad9f3b05a9eeb6feb7b1abea3151b3bc", "sha256": "273881b2084e556a57d303df4d0b062d824b67c80a54122430de02e81a8028fc" }, "downloads": -1, "filename": "raphendyr-django-essentials-1.1.0.tar.gz", "has_sig": false, "md5_digest": "ad9f3b05a9eeb6feb7b1abea3151b3bc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12796, "upload_time": "2017-10-19T14:14:00", "url": "https://files.pythonhosted.org/packages/ae/a5/24d37f4d91957fb892af0142a1f2e3e59a477a6be0cf708e011369cec4cd/raphendyr-django-essentials-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "31f4d22c4b0f4b37700fb4374b68cc16", "sha256": "73ad6dd5a4749171ab81b68d5442d89357c7f23b41382563dbd162beb3e48726" }, "downloads": -1, "filename": "raphendyr-django-essentials-1.1.1.tar.gz", "has_sig": false, "md5_digest": "31f4d22c4b0f4b37700fb4374b68cc16", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12806, "upload_time": "2017-11-20T15:23:06", "url": "https://files.pythonhosted.org/packages/83/5c/e6ed8b3bf2e8b56f7458063f8f29a941e1917b97a1d54a70658171b9d5dc/raphendyr-django-essentials-1.1.1.tar.gz" } ], "1.1.2": [ { "comment_text": "", "digests": { "md5": "6ed2d2ee842a6467987eed94874411cf", "sha256": "ff68def4cc552daffafd794c9edc303efe0a0f6361060318973dedd5de09986f" }, "downloads": -1, "filename": "raphendyr-django-essentials-1.1.2.tar.gz", "has_sig": false, "md5_digest": "6ed2d2ee842a6467987eed94874411cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12813, "upload_time": "2017-12-20T20:22:25", "url": "https://files.pythonhosted.org/packages/b1/66/08ac9fb7c087479b5eb2b7fccfdd755c37c5d9eeeb49990e90772461e64d/raphendyr-django-essentials-1.1.2.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "c80d81b0fca0695847f60438346e23ad", "sha256": "a1eb139184b36c13e8b130dbd4874820cdbee192e484bd6d4a04da9e0504b83b" }, "downloads": -1, "filename": "raphendyr-django-essentials-1.2.0.tar.gz", "has_sig": false, "md5_digest": "c80d81b0fca0695847f60438346e23ad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13719, "upload_time": "2018-01-18T23:48:51", "url": "https://files.pythonhosted.org/packages/b4/2d/4e5aed1f1edc8e18700450e39f7d25834847391142e784eaa674c82c6563/raphendyr-django-essentials-1.2.0.tar.gz" } ], "1.2.1": [ { "comment_text": "", "digests": { "md5": "6f127be54ce194c728c8a19996bf518c", "sha256": "70ccd32dba52e56212e071d8aa375d2e44a6457fdd71fa3e59aa1330c1a97bed" }, "downloads": -1, "filename": "raphendyr-django-essentials-1.2.1.tar.gz", "has_sig": false, "md5_digest": "6f127be54ce194c728c8a19996bf518c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13749, "upload_time": "2018-01-29T11:13:28", "url": "https://files.pythonhosted.org/packages/80/a1/46a04f9889b35aba7717eb393acc46303757733c33382dd955820aca1d2d/raphendyr-django-essentials-1.2.1.tar.gz" } ], "1.3.0": [ { "comment_text": "", "digests": { "md5": "12ab886e621ff9ffb36ca21162fdbf4a", "sha256": "345400c1f22163a2588052c2cbfbcf4c394b1f2d26b69517731feb2a8fa3879e" }, "downloads": -1, "filename": "raphendyr-django-essentials-1.3.0.tar.gz", "has_sig": false, "md5_digest": "12ab886e621ff9ffb36ca21162fdbf4a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15801, "upload_time": "2018-06-26T15:18:05", "url": "https://files.pythonhosted.org/packages/ef/c7/89948ef06d3ca427ec279647926ed6e729320014967915eb0beca2e00b93/raphendyr-django-essentials-1.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "12ab886e621ff9ffb36ca21162fdbf4a", "sha256": "345400c1f22163a2588052c2cbfbcf4c394b1f2d26b69517731feb2a8fa3879e" }, "downloads": -1, "filename": "raphendyr-django-essentials-1.3.0.tar.gz", "has_sig": false, "md5_digest": "12ab886e621ff9ffb36ca21162fdbf4a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15801, "upload_time": "2018-06-26T15:18:05", "url": "https://files.pythonhosted.org/packages/ef/c7/89948ef06d3ca427ec279647926ed6e729320014967915eb0beca2e00b93/raphendyr-django-essentials-1.3.0.tar.gz" } ] }