django-fastdev
==============
:code:`django-fastdev` is an app that makes it safer, faster and more fun to develop Django apps.
Features
--------
Error on non-existent template variables
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Django templates by default hide errors, and when it does show an error it's often not very helpful. This app will change this so that if you do:
.. code:: html
{{ does_not_exist }}
instead of rendering that as an empty string, this app will give you an error message:
.. code::
does_not_exist does not exist in context. Available top level variables:
DEFAULT_MESSAGE_LEVELS
False
None
True
bar
csrf_token
foo
messages
perms
request
user
There are more specialized error messages for when you try to access the contents of a :code:`dict`, and attributes of an object a few levels deep like :code:`foo.bar.baz` (where baz doesn't exist).
By default, :code:`django-fastdev` only checks templates that exist within your project directory. If you want it to check ALL templates, including stock django templates and templates from third party libraries, add :code:`FASTDEV_STRICT_TEMPLATE_CHECKING = True` to your project :code:`settings.py`.
NoReverseMatch errors
~~~~~~~~~~~~~~~~~~~~~
Have you ever gotten this error?
.. code::
django.urls.exceptions.NoReverseMatch: Reverse for 'view-name' with arguments '('',)' not found. 1 pattern(s) tried:
It's because you have :code:`{% url 'view-name' does_not_exist %}`. Django sees
:code:`does_not_exist` and evaluates it to the empty string because it doesn't exist.
So that's why you get an error message that makes no sense. :code:`django-fastdev` will
make your code crash on the actual error: :code:`does_not_exist` doesn't exist.
Error if you have non-space text outside a block when extending
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A common mistake for beginners that can be hard to spot is when they do:
.. code-block:: html
<html>
{% extends "something.html" %}
stuff here
</html>
Django silently throws away :code:`stuff here` and :code:`</html>`. :code:`django-fastdev` makes this an error.
Error on invalid block names when using :code:`{% extends "..." %}`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you have a base template:
.. code-block:: html
<html>
<body>
{% block content %}{% endblock %}
</body>
</html>
and then write a template like this:
.. code-block:: html
{% extends "base.html" %}
{% block contents %}
hello!
{% endblock %}
Django will silently throw away `hello!` because you wrote :code:`contents` instead
of :code:`content`. :code:`django-fastdev` will turn this into an error which lists the
invalid and valid block names in alphabetical order.
Better error messages for reverse
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The standard error message for a bad :code:`reverse()/{% url %}` are rather sparse.
:code:`django-fastdev` improves them by listing valid patterns so you can easily see
the problem.
Better error messages for QuerySet.get()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The error message for :code:`QuerySet.get()` is improved to give you the query
parameters that resulted in the exception.
Validate clean_* methods
~~~~~~~~~~~~~~~~~~~~~~~~
A common mistake is to make a form clean method and make a spelling error. By
default Django just won't call the function. With :code:`django-fastdev` you will get
an error message telling you that your clean method doesn't match anything.
This is also very useful during refactoring. Renaming a field is a lot safer
as if you forget to rename the clean method :code:`django-fastdev` will tell you!
Faster startup
~~~~~~~~~~~~~~
The initial model checks can be quite slow on big projects. :code:`django-fastdev`
will move these checks to a separate thread, so the runserver startup time is
lowered, so you don't have to wait for the runserver restart as long.
Usage
------
First install: :code:`pip install django-fastdev`
In :code:`settings.py` add :code:`django_fastdev` to INSTALLED_APPS:
.. code:: python
INSTALLED_APPS = [
# ...
'django_fastdev',
]
Enjoy a nicer Django experience!
License
-------
BSD
Raw data
{
"_id": null,
"home_page": "https://github.com/boxed/django-fastdev",
"name": "django-fastdev",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "django",
"author": "Anders Hovm\u00f6ller",
"author_email": "boxed@killingar.net",
"download_url": "https://files.pythonhosted.org/packages/c4/ce/4df4b564c1f890463f5b7c4b1d81976d08dbafdb0e23c23faedda770a297/django_fastdev-1.12.0.tar.gz",
"platform": null,
"description": "django-fastdev\n==============\n\n:code:`django-fastdev` is an app that makes it safer, faster and more fun to develop Django apps.\n\nFeatures\n--------\n\n\nError on non-existent template variables\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nDjango templates by default hide errors, and when it does show an error it's often not very helpful. This app will change this so that if you do:\n\n.. code:: html\n\n {{ does_not_exist }}\n\ninstead of rendering that as an empty string, this app will give you an error message:\n\n.. code::\n\n does_not_exist does not exist in context. Available top level variables:\n\n DEFAULT_MESSAGE_LEVELS\n False\n None\n True\n bar\n csrf_token\n foo\n messages\n perms\n request\n user\n\nThere are more specialized error messages for when you try to access the contents of a :code:`dict`, and attributes of an object a few levels deep like :code:`foo.bar.baz` (where baz doesn't exist).\n\nBy default, :code:`django-fastdev` only checks templates that exist within your project directory. If you want it to check ALL templates, including stock django templates and templates from third party libraries, add :code:`FASTDEV_STRICT_TEMPLATE_CHECKING = True` to your project :code:`settings.py`.\n\n\nNoReverseMatch errors\n~~~~~~~~~~~~~~~~~~~~~\n\nHave you ever gotten this error?\n\n.. code::\n\n django.urls.exceptions.NoReverseMatch: Reverse for 'view-name' with arguments '('',)' not found. 1 pattern(s) tried:\n\n\nIt's because you have :code:`{% url 'view-name' does_not_exist %}`. Django sees\n:code:`does_not_exist` and evaluates it to the empty string because it doesn't exist.\nSo that's why you get an error message that makes no sense. :code:`django-fastdev` will\nmake your code crash on the actual error: :code:`does_not_exist` doesn't exist.\n\n\nError if you have non-space text outside a block when extending\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nA common mistake for beginners that can be hard to spot is when they do:\n\n.. code-block:: html\n\n <html>\n {% extends \"something.html\" %}\n stuff here\n </html>\n\nDjango silently throws away :code:`stuff here` and :code:`</html>`. :code:`django-fastdev` makes this an error.\n\n\nError on invalid block names when using :code:`{% extends \"...\" %}`\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nIf you have a base template:\n\n.. code-block:: html\n\n <html>\n <body>\n {% block content %}{% endblock %}\n </body>\n </html>\n\nand then write a template like this:\n\n.. code-block:: html\n\n {% extends \"base.html\" %}\n\n {% block contents %}\n hello!\n {% endblock %}\n\n\nDjango will silently throw away `hello!` because you wrote :code:`contents` instead\nof :code:`content`. :code:`django-fastdev` will turn this into an error which lists the\ninvalid and valid block names in alphabetical order.\n\nBetter error messages for reverse\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe standard error message for a bad :code:`reverse()/{% url %}` are rather sparse.\n:code:`django-fastdev` improves them by listing valid patterns so you can easily see\nthe problem.\n\n\nBetter error messages for QuerySet.get()\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe error message for :code:`QuerySet.get()` is improved to give you the query\nparameters that resulted in the exception.\n\n\nValidate clean_* methods\n~~~~~~~~~~~~~~~~~~~~~~~~\n\nA common mistake is to make a form clean method and make a spelling error. By\ndefault Django just won't call the function. With :code:`django-fastdev` you will get\nan error message telling you that your clean method doesn't match anything.\n\nThis is also very useful during refactoring. Renaming a field is a lot safer\nas if you forget to rename the clean method :code:`django-fastdev` will tell you!\n\n\nFaster startup\n~~~~~~~~~~~~~~\n\nThe initial model checks can be quite slow on big projects. :code:`django-fastdev`\nwill move these checks to a separate thread, so the runserver startup time is\nlowered, so you don't have to wait for the runserver restart as long.\n\n\nUsage\n------\n\nFirst install: :code:`pip install django-fastdev`\n\nIn :code:`settings.py` add :code:`django_fastdev` to INSTALLED_APPS:\n\n.. code:: python\n\n INSTALLED_APPS = [\n # ...\n 'django_fastdev',\n ]\n\n\nEnjoy a nicer Django experience!\n\n\nLicense\n-------\n\nBSD\n",
"bugtrack_url": null,
"license": "BSD",
"summary": "Django-fastdev is an app that makes it faster and more fun to develop Django apps",
"version": "1.12.0",
"project_urls": {
"Homepage": "https://github.com/boxed/django-fastdev"
},
"split_keywords": [
"django"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c4ce4df4b564c1f890463f5b7c4b1d81976d08dbafdb0e23c23faedda770a297",
"md5": "3614a571192ccd157ee315c67e4a7a8d",
"sha256": "83a44d5cc1e8f72afb361caf9f6dbb0617587653837c213f32f4fab13f90acdb"
},
"downloads": -1,
"filename": "django_fastdev-1.12.0.tar.gz",
"has_sig": false,
"md5_digest": "3614a571192ccd157ee315c67e4a7a8d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 15363,
"upload_time": "2024-10-12T19:21:57",
"upload_time_iso_8601": "2024-10-12T19:21:57.218315Z",
"url": "https://files.pythonhosted.org/packages/c4/ce/4df4b564c1f890463f5b7c4b1d81976d08dbafdb0e23c23faedda770a297/django_fastdev-1.12.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-12 19:21:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "boxed",
"github_project": "django-fastdev",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"test_requirements": [
{
"name": "hammett",
"specs": []
},
{
"name": "pytest-django",
"specs": []
},
{
"name": "django",
"specs": []
}
],
"tox": true,
"lcname": "django-fastdev"
}