Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/boxed/django-fastdev
An app to make it safer, faster and more fun to develop in Django
https://github.com/boxed/django-fastdev
django python
Last synced: 1 day ago
JSON representation
An app to make it safer, faster and more fun to develop in Django
- Host: GitHub
- URL: https://github.com/boxed/django-fastdev
- Owner: boxed
- License: bsd-3-clause
- Created: 2020-08-07T11:45:15.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-12-31T12:22:49.000Z (13 days ago)
- Last Synced: 2025-01-05T06:03:36.646Z (9 days ago)
- Topics: django, python
- Language: Python
- Homepage:
- Size: 108 KB
- Stars: 175
- Watchers: 9
- Forks: 14
- Open Issues: 17
-
Metadata Files:
- Readme: README.rst
- Changelog: HISTORY.rst
- License: LICENSE
- Authors: AUTHORS.rst
Awesome Lists containing this project
- stars - boxed/django-fastdev - An app to make it safer, faster and more fun to develop in Django (Python)
- stars - boxed/django-fastdev - An app to make it safer, faster and more fun to develop in Django (Python)
README
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
userThere 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`.
Improved TemplateDoesNotExist errors
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Good suggestions for what you wanted to do, and a complete list of all valid values makes it very easy to fix `TemplateDoesNotExist` errors.
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
{% extends "something.html" %}
stuff here
Django silently throws away :code:`stuff here` and :code:`
{% block content %}{% endblock %}