Tag: django

  1. Updated

    Create a custom migration in Django

    Category: Database, Python

    ALTER TABLE app_repostarring CHANGE repo_description repo_description VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

  2. Updated

    Lazy evaluation in Django middlewares

    Category: Python, Web Development

    Attach a lazy evaluated function as a property of request in a middleware.

  3. 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)。

  4. Updated

    Configure i18n Translations in Django

    Category: Python, Web Development

    Internationalization and localization for your Django project.

  5. 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.

  6. 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.

  7. Updated

    Database Routers in Django

    Category: Database, Python, Web Development

    把部分 models / tables 獨立到一台資料庫

  8. 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.

  9. 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.

  10. Updated

    Parse datetime in Python and JavaScript

    Category: JavaScript, Python, Web Development

    Use dateutil and moment.js