Browsed by
Category: Tips and Tricks

Django 301 redirect problem with React

Django 301 redirect problem with React

The answer is: ‘/’ Sometimes when you change your client-side code, and suddenly you experience a 301 redirect response from your server-side. In my case, I was using Django as a serverside and use ReactJS as a client-side. The API was implemented in a RESTful style. Most of the cases, the reason was I forgot to end with ‘/’ in my request URL. (Good) https://api.example.com/api/100/ (Bad) https://api.example.com/api/100 I haven’t really investigated what is behind this rule but, don’t panic and…

Read More Read More

Sending simultaneous requests using Python

Sending simultaneous requests using Python

Python is a perfect programming language unless you have to deal with asynchronous action. Many programmers using Javascript complain about ‘callback hell’. Still, people become grateful when they have to deal with asynchronous action (simultaneous, parallel, concurrent, etc.). Recently I needed to send several requests at the same time, instead of waiting for the previous request to finish. Moreover, all responses should be collected as one variable. 1. Ordinary request If we call 10 requests sequentially, it took 11.285 seconds….

Read More Read More