Using Google reCAPTCHA in Django forms is one of the best way to prevent login attack in your Django application. Although you may deploy other measures like blocking user after 3 unsuccessful attempts or blocking the IP address but I think reCAPTCHA is one of the most widely used method to stop bots from attacking your login/sign-in page.
In this article we will see how to use Google reCAPTCHA in Django forms.
Continue reading “How to use Google reCAPTCHA in Django”
Consider these scenario in your newly developed Django Application:
- You need to send promotional emails to all the registered users.
- You need to send email confirmation link or password reset link.
- You need to send weekly newsletter to you readers.
What do you choose? Free Gmail Account to send email using python code? That is a nice idea provided you want to look unprofessional and you need not to send more than 500 emails per day.
But if you want professional look in your emails [from address something like
email@example.com instead of
firstname.lastname@example.org and do not want the limit on per day email count, then this article is for you.
Continue reading “How to send bulk emails for free using Mailgun and Python Django”
At some point in your project development process you will need AJAX to execute some task. One fine example could be checking username availability on signup form. We will discuss same scenario here and will guide you through the step by step process of using AJAX with Django.
Continue reading “How to use AJAX with Django”
You must have used createsuperuser command in your django application at one or other time. If not then I am sure you must have used makemigrations or migrate commands in your project. Yes? Yes.
So these commands, also called as management commands are used to execute some piece of code from command line. In this article I will tell you how to create your own command.
Why do you need management command:
First thing that comes to your mind after reading above paragraph is that why do even I need management command in my project.
Lets say you have a project where you need to perform some task periodically. For example : updating database column after fetching data from some other server, sending lots of mails, taking backup of your database etc etc.
Continue reading “How to create management commands in Django”
It happens very frequently that a visitor on your website typed a wrong URL or the page user is looking for no longer exists. What do you do to handle such cases.
You have three options.
- Redirect the visitor to home page, silently.
- Show a boring 404 page and then ask them to click on a link.
- Create your own funny/awesome/informative custom 404 error page.
In this article we will discuss the third option.
Continue reading “Designing custom 404 and 500 error pages in Django”
To send email using python script via Office 365, use below code. This code is tried and tested.
Continue reading “How to send email from Python and Django using Office 365”
In this article we will discuss how to upload a csv file and then process the content without storing file on server. One approach could be uploading the file, storing it in upload directory and then reading the file. Another approach could be uploading file and reading it directly from post data without storing it in memory and displaying the data.
We will work with the later approach here.
Continue reading “How to upload and process the CSV file in Django”