Personal tools
Skip to content. | Skip to navigation
A Django App that adds Cross-Origin Resource Sharing (CORS) headers to responses. This allows in-browser requests to your Django application from other origins. Improve your Django and Git skills with my books. About CORS Adding CORS headers allows your resources to be accessed on other domains. It’s important you understand the implications before adding the headers, since you could be unintentionally opening up your site’s private data to others. Some good resources to read on the subject are: Julia Evans’ introductory comic and educational quiz. Jake Archibald’s How to win at CORS The MDN Article The HTML5 Rocks Tutorial The Wikipedia Page Requirements Python 3.8 to 3.12 supported. Django 3.2 to 5.0 supported. Setup Install from pip: python -m pip install django-cors-headers and then add it to your installed apps: INSTALLED_APPS = [ ..., "corsheaders", ..., ] Make sure you add the trailing comma or you might get a ModuleNotFoundError (see this blog post). You will
django-cors-headers is a Django application for handling the server headers required for Cross-Origin Resource Sharing (CORS).
The best way to have Django DRY forms. Build programmatic reusable layouts out of components, having full control of the rendered HTML without writing HTML in templates. All this without breaking the standard way of doing things in Django, so it plays nice with any other form application. django-crispy-forms supports Django 4.2+ with Python 3.8+. Looking for Bootstrap 5 support? See the crispy-bootstrap5 package. The application mainly provides: A filter named |crispy that will render elegant div based forms. Think of it as the built-in methods: as_table, as_ul and as_p. You cannot tune up the output, but it is easy to start using it. A tag named {% crispy %} that will render a form based on your configuration and specific layout setup. This gives you amazing power without much hassle, helping you save tons of time. Django-crispy-forms supports several frontend frameworks, such as Twitter Bootstrap (versions 2, 3, and 4), tailwind, Bulma and Foundation. You can also easily adapt your
Conveniently store reference to request user on thread/db level. Quickstart Differences to django-cuser Release Notes Contributing Reporting issues/improvements Pull Requests Setting up all Python versions Code of Conduct Quickstart Install django-currentuser: pip install django-currentuser Add it to the middleware classes in your settings.py: MIDDLEWARE = ( ..., 'django_currentuser.middleware.ThreadLocalUserMiddleware', ) Then use it in a project: from django_currentuser.middleware import ( get_current_user, get_current_authenticated_user) from django_currentuser.db.models import CurrentUserField class Foo(models.Model): created_by = CurrentUserField() updated_by = CurrentUserField(on_update=True) Differences to django-cuser Both libraries serve the same purpose, but be aware of these differences (as of django-cuser v.2017.3.16): django-currentusers CurrentUserField stores the reference to the request user at initialization of the mod
This simple Django utility allows you to utilize the 12factor inspired DATABASE_URL environment variable to configure your Django application. This simple Django utility allows you to utilize the 12factor inspired DATABASE_URL environment variable to configure your Django application.
Django Database Connection Autoreconnect This library monkeypatches django.db.backends.base.BaseDatabaseWrapper so that when a database operation fails because the underlying TCP connection was already closed, it first tried to reconnect, instead of immediately raising an OperationException. Why is this useful? I use HAProxy as a load-balancer in front of my PostgreSQL databases all the time, sometimes in addition to pgbouncer. Even though you can mostly prevent surprises by enabling TCP keep-alive packets through tcpka, clitcpka and srvtcpka, I still encounter situations where the underlying TCP connection has been closed through the load-balancer. Most often this results in django.db.utils.OperationalError: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. This library patches Django such that it try to reconnect once before failing. Another application of this is when using Hashicorp Vault, where
Basic/extra mitigation against the BREACH attack for Django projects. When combined with rate limiting in your web-server, or by using something like django-ratelimit, the techniques here should provide at least some protection against the BREACH attack.
The Django Debug Toolbar is a configurable set of panels that display various debug information about the current request/response and when clicked, display more details about the panel's content. Currently, the following panels have been written and are working: - Django version - Request timer - A list of settings in settings.py - Common HTTP headers - GET/POST/cookie/session variable display - Templates and context used, and their template paths - SQL queries including time to execute and links to EXPLAIN each query - List of signals, their args and receivers - Logging output via Python's built-in logging, or via the logbook module
Django - Deprecate Field[![PyPi]( [![License]( [![Contributing]( [![3yourminD- Careers]( [![Stars](
An alternative Django TEST_RUNNER which uses the unittest2 test discovery from a base path specified in the settings, or any other module or package specified to the test management command -- including app tests. This package includes Python 3 build of django-discover-runner.