Tag: django
-
Updated
Create a custom migration in Django
ALTER TABLE app_repostarring CHANGE repo_description repo_description VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-
Updated
Lazy evaluation in Django middlewares
Category: Python, Web Development
Attach a lazy evaluated function as a property of request in a middleware.
-
Updated
Django's get_or_create() may raise IntegrityError but subsequent get() raises DoesNotExist
Category: Database, Python, Web Development
get_or_create() 拋出 IntegrityError 但是接著 get() 一次卻會是 DoesNotExist,以上的錯誤常常會發生在 MySQL 的 isolation level 是 REPEATABLE READ 的情況下。MySQL 默認採用 REPEATABLE READ(而 PostgreSQL 預設是 READ COMMITTED)。
-
Updated
Configure i18n Translations in Django
Category: Python, Web Development
Internationalization and localization for your Django project.
-
Updated
Tools for Profiling your Python Projects
Category: Python, Web Development
Tools you could use to profile your Python, Django or Flask projects, including: timer, pycallgraph, cProfile, line-profiler, memory-profiler.
-
Updated
django-debug-toolbar: The Debugging Toolkit for Django
Category: Python, Web Development
django-debug-toolbar is a toolbox to display various debug information about the current request and response in Django.
-
Updated
-
Updated
Read and Write Files in Django and Python
Category: Python, Web Development
File and ImageFile take a Python file or StringIO object, ContentFile takes a string. Examples for saving an upload to a model field included.
-
Updated
HTTP Cache Headers in Django
Category: Python, Web Development
Conditional view processing with @condition, and what Django's cache middleware adds to Cache-Control, Expires, and Last-Modified. no-store vs no-cache included.
-
Updated
Parse datetime in Python and JavaScript
Category: JavaScript, Python, Web Development
Use dateutil and moment.js