Eduardo Zepeda's latests posts
Caching in Django REST Framework using memcached
- django
<p>To use the cache in django, just follow three simple steps:</p><div class="google-ads-container-8672022193"> <ins class="adsbygoogle" style="display:block; text-align:center;" data-ad-layout="in-article" data-ad-format="f...
Read more
Periodic Tasks with Celery and Django
- django
<p>In addition to creating asynchronous tasks, celery also allows you to create periodic tasks, which are executed from time to time. This can be quite useful to give maintenance to the database from time to time, to send marketing or shopping cart recovery emails, perhaps even t...
Read more
How to use Django Framework asynchronously using Celery
- django
<p>Celery, in combination with Django serve to solve a problem: the lack of asynchrony in our application. Sending an email, processing some file or responding to a third party service will keep our execution waiting for the task to finish and, as a consequence, our user waiting....
Read more
Login using Django Rest Framework DRF
- django
<p>Almost all complex Django applications need views for Login, Logout, reboot and password change, as well as user registration. However, both Django and Django REST Framework (DRF) are completely agnostic about their implementation, and delegate the responsibility for these fun...
Read more
React memo, useMemo and useCallback to avoid React renderings
- react
<p>We can use react memo and useCallback to prevent a component from being rendered, uselessly, multiple times by memoization. If you don't know what memoization is or don't understand what the react components, useCallback and memo are for, I have a post where I expl...
Read more
React useCallback, useMemo and memo, differences
- react
<p>The useCallback, useMemo and memo functions are used to optimize React applications using memoization, avoiding useless renderings, each with their differences, similarities and use cases. These three functions should not be used indiscriminately, but only in those situations ...
Read more
Mexico Postal codes API with Django
- django
<p>Do you need to get the data associated with a postal code in Mexico for your Django application? I wrote a small library called <strong>django-postalcodes-mexico</strong> that downloads postal codes from SEPOMEX (México's Postal Codes official site) and creates an API en...
Read more
Django and htmx, modern web apps without writing JS
- django
- htmx
<p>The other day I was testing a library called htmx, which promises to make web creation much easier, yes, another library, but with the difference that this one doesn't need you to write Javascript (JS) and it also combines quite well with Django. Htmx bases all its opera...
Read more
Django Rest Framework and JWT to authenticate users
- django
- javascript
<p>JWTs (JSON Web Tokens) have become extremely popular, some even consider them a replacement for the classic tokens used by other frameworks, such as the Django Rest Framework. Using JWT or regular tokens (SWT) allows you to store all your session information directly on the to...
Read more
Managers or custom handlers in Django
- django
- databases
<p>A Manager (or handler) is the interface through which query operations or queries from the database are provided to Django models. Yes, I mean that <em>objects</em> that goes after the name of your model; <em>YourModel.objects.all()</em> and <em>Tumodel.objects.filter()</em>. ...
Read more
- Install a caching system, be it redis, memcached, etc.
- Set the CACHES variable to the settings.py file of the project.
- Add the middleware necessary for django to return the cache before processing the view.
- Use the low-level cache to cache specific views or data (optional).
Implementing a caching system allows you to greatly improve the performance of an application made in Django .
","datePublished":"Tue, 07 Sep 2021 00:00:00 +0000","dateModified":"Tue, 07 Sep 2021 00:00:00 +0000","author":{"@type":"Person","name":"Eduardo Zepeda"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://coffeebytes.dev/en/django/caching-in-django-rest-framework-using-memcached/"}},{"@type":"BlogPosting","headline":"Periodic Tasks with Celery and Django","description":"In addition to creating asynchronous tasks, celery also allows you to create periodic tasks, which are executed from time to time. This can be quite useful to give maintenance to the database from time to time, to send marketing or shopping cart recovery emails, perhaps even to empty the contents of some temporary cache in the database or any repetitive task where execution time is an important factor, that is, to improve the performance of a django application.
","datePublished":"Tue, 31 Aug 2021 00:00:00 +0000","dateModified":"Tue, 31 Aug 2021 00:00:00 +0000","author":{"@type":"Person","name":"Eduardo Zepeda"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://coffeebytes.dev/en/django/periodic-tasks-with-celery-and-django/"}},{"@type":"BlogPosting","headline":"How to use Django Framework asynchronously using Celery","description":"Celery, in combination with Django serve to solve a problem: the lack of asynchrony in our application. Sending an email, processing some file or responding to a third party service will keep our execution waiting for the task to finish and, as a consequence, our user waiting.
Using celery is one of the things you can do to improve the performance of a Django application . And you can also create periodic tasks with celery and django.
","datePublished":"Tue, 24 Aug 2021 00:00:00 +0000","dateModified":"Tue, 24 Aug 2021 00:00:00 +0000","author":{"@type":"Person","name":"Eduardo Zepeda"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://coffeebytes.dev/en/django/how-to-use-django-framework-asynchronously-using-celery/"}},{"@type":"BlogPosting","headline":"Login using Django Rest Framework DRF","description":"Almost all complex Django applications need views for Login, Logout, reboot and password change, as well as user registration. However, both Django and Django REST Framework (DRF) are completely agnostic about their implementation, and delegate the responsibility for these functions to the users of their frameworks. Fortunately there are libraries that make this task quite simple.
If you are about to develop an API, I have a post with recommendations on REST API design that can be useful for you.
","datePublished":"Tue, 17 Aug 2021 00:00:00 +0000","dateModified":"Tue, 17 Aug 2021 00:00:00 +0000","author":{"@type":"Person","name":"Eduardo Zepeda"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://coffeebytes.dev/en/django/login-using-django-rest-framework-drf/"}},{"@type":"BlogPosting","headline":"React memo, useMemo and useCallback to avoid React renderings","description":"We can use react memo and useCallback to prevent a component from being rendered, uselessly, multiple times by memoization. If you don’t know what memoization is or don’t understand what the react components, useCallback and memo are for, I have a post where I explain React’s useCallback, useMemo and memo, and what they are for .
","datePublished":"Tue, 10 Aug 2021 00:00:00 +0000","dateModified":"Tue, 10 Aug 2021 00:00:00 +0000","author":{"@type":"Person","name":"Eduardo Zepeda"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://coffeebytes.dev/en/react/react-memo-usememo-and-usecallback-to-avoid-react-renderings/"}},{"@type":"BlogPosting","headline":"React useCallback, useMemo and memo, differences","description":"The useCallback, useMemo and memo functions are used to optimize React applications using memoization, avoiding useless renderings, each with their differences, similarities and use cases. These three functions should not be used indiscriminately, but only in those situations where their impact is less than the benefits they offer.
","datePublished":"Mon, 02 Aug 2021 00:00:00 +0000","dateModified":"Mon, 02 Aug 2021 00:00:00 +0000","author":{"@type":"Person","name":"Eduardo Zepeda"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://coffeebytes.dev/en/react/react-memo-usememo-and-usecallback-to-avoid-react-renderings/"}},{"@type":"BlogPosting","headline":"Mexico Postal codes API with Django","description":"Do you need to get the data associated with a postal code in Mexico for your Django application? I wrote a small library called django-postalcodes-mexico that downloads postal codes from SEPOMEX (México’s Postal Codes official site) and creates an API endpoint that allows you to query a postal code in Mexico and receive the colonias that belong to that postal code, as well as their state and municipality.
If you are going to develop a REST API, I have a post with multiple REST API design recommendations that may help you.
","datePublished":"Thu, 22 Jul 2021 00:00:00 +0000","dateModified":"Thu, 22 Jul 2021 00:00:00 +0000","author":{"@type":"Person","name":"Eduardo Zepeda"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://coffeebytes.dev/en/django/mexico-postal-codes-api-with-django/"}},{"@type":"BlogPosting","headline":"Django and htmx, modern web apps without writing JS","description":"The other day I was testing a library called htmx, which promises to make web creation much easier, yes, another library, but with the difference that this one doesn’t need you to write Javascript (JS) and it also combines quite well with Django. Htmx bases all its operation on writing attributes in your HTML tags, which are responsible for abstracting all the JS that runs behind the scenes. The result is code consisting only of HTML tags and their attributes, with no JS code (well, maybe just a little). No, you don’t have to abandon all the JS, don’t worry, you can also combine htmx with your favorite libraries and vanilla JS code.
","datePublished":"Wed, 14 Jul 2021 00:00:00 +0000","dateModified":"Wed, 14 Jul 2021 00:00:00 +0000","author":{"@type":"Person","name":"Eduardo Zepeda"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://coffeebytes.dev/en/django/django-and-htmx-modern-web-apps-without-writing-js/"}},{"@type":"BlogPosting","headline":"Django Rest Framework and JWT to authenticate users","description":"JWTs (JSON Web Tokens) have become extremely popular, some even consider them a replacement for the classic tokens used by other frameworks, such as the Django Rest Framework. Using JWT or regular tokens (SWT) allows you to store all your session information directly on the token and they are also cryptographically signed, sounds good doesn’t it?
What is JWT?
JWT is a standard for the creation of JSON-based access tokens for the exchange of information between two parties. These tokens, and their content, can be verified because they are digitally signed. This cryptographic signature guarantees that the content has not been altered and that the issuer is who they say they are. This makes them perfect for:
","datePublished":"Mon, 14 Jun 2021 00:00:00 +0000","dateModified":"Mon, 14 Jun 2021 00:00:00 +0000","author":{"@type":"Person","name":"Eduardo Zepeda"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://coffeebytes.dev/en/django/django-rest-framework-and-jwt-to-authenticate-users/"}},{"@type":"BlogPosting","headline":"Managers or custom handlers in Django","description":"A Manager (or handler) is the interface through which query operations or queries from the database are provided to Django models. Yes, I mean that objects that goes after the name of your model; YourModel.objects.all() and Tumodel.objects.filter(). All Django models have at least one manager. Whenever you use the object manager (I will refer to it as manager from here on) in a database query using the Django ORM you are making use of its default object manager. These managers in Django can be customized to modify the objects returned by a query and we can customize them to our liking.
","datePublished":"Fri, 28 May 2021 00:00:00 +0000","dateModified":"Fri, 28 May 2021 00:00:00 +0000","author":{"@type":"Person","name":"Eduardo Zepeda"},"mainEntityOfPage":{"@type":"WebPage","@id":"https://coffeebytes.dev/en/django/managers-or-custom-handlers-in-django/"}}]}