Blog Info | Adam Johnson |
---|---|
Blog website | Link |
Oct. 12, 2022 » Adam Johnson » [Archived Version]
In data import processes it’s often useful to have a “dry run” mode, that runs through the process but doesn’t actually save the data. This can allow you to check for validity and gather statistics, such as how many records already exist in the database. In this post …
Read MoreOct. 12, 2022 » Adam Johnson » [Archived Version]
In data import processes it’s often useful to have a “dry run” mode, that runs through the process but doesn’t actually save the data. This can allow you to check for validity and gather statistics, such as how many records already exist in the database. In this post …
Read MoreOct. 5, 2022 » Adam Johnson » [Archived Version]
You want to pass your data from your Django view to JavaScript, in your template. And, you want to do it securely, with no risk of accidentally allowing malicious code injection. Great, this is the post for you! We’re going to look at the problems with templating JavaScript, then …
Read MoreOct. 5, 2022 » Adam Johnson » [Archived Version]
You want to pass your data from your Django view to JavaScript, in your template. And, you want to do it securely, with no risk of accidentally allowing malicious code injection. Great, this is the post for you! We’re going to look at the problems with templating JavaScript, then …
Read MoreAug. 21, 2022 » Adam Johnson » [Archived Version]
Django’s transaction.on_commit() allows you to run a function after the current database transaction is committed. This is useful to ensure that actions with external services, like sending emails, don’t run until the relevant data is definitely saved. Although Django’s documentation says that on_commit() takes a “function …
Read MoreAug. 21, 2022 » Adam Johnson » [Archived Version]
Django’s transaction.on_commit() allows you to run a function after the current database transaction is committed. This is useful to ensure that actions with external services, like sending emails, don’t run until the relevant data is definitely saved. Although Django’s documentation says that on_commit() takes a “function …
Read MoreJune 28, 2022 » Adam Johnson » [Archived Version]
Normally your Django project’s deploy process runs the migrate command, and that takes care of updating your database as necessary. Especially on smaller databases, Django’s migration system can “just do it” for you. But sometimes it can be necessary to run migrations “by hand” in your database’s …
Read MoreJune 28, 2022 » Adam Johnson » [Archived Version]
Normally your Django project’s deploy process runs the migrate command, and that takes care of updating your database as necessary. Especially on smaller databases, Django’s migration system can “just do it” for you. But sometimes it can be necessary to run migrations “by hand” in your database’s …
Read MoreJune 22, 2022 » Adam Johnson » [Archived Version]
Python’s requests package is very popular. Even if you don’t use it directly, it’s highly likely one of your dependencies does. One wrinkle in requests’ design is that it has no default timeout. This means that requests can hang forever if the remote server doesn’t respond …
Read MoreJune 22, 2022 » Adam Johnson » [Archived Version]
Python’s requests package is very popular. Even if you don’t use it directly, it’s highly likely one of your dependencies does. One wrinkle in requests’ design is that it has no default timeout. This means that requests can hang forever if the remote server doesn’t respond …
Read More