Update 1: Please refer this updated article for Django 2.0 and source code.
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”
While working on some django project you might feel that the default user model is not fulfilling all the requirements. For example you may want to authenticate users by email Id and not by username. You may want to store some more extra information in the user model. In short you might want to define your own custom user model.
In particular we may encounter one out of below four scenarios:
- You are happy with the way default authentication but you need to store extra information in the model itself.
- You want different authentication process, for example using email, but do not want to store extra information.
Continue reading “Creating custom user model and custom authentication in Django”
In this article I will teach you how to make and run a python-django app in less than 5 minutes.
Prerequisite: Python (preferably python 3) is already installed.
Step to create and run the django app:
- Install virtual environment. You may proceed without virtual environment too, but in long run it is going to be very helpful.
$ pip install virtualenv
Continue reading “Hello Word in Django : How to start with Django”
So you developed a course project which you need to host somewhere so that everyone can access it.
Or you are working on some personal project and want to host it so that test users can test it.
What do you do in such scenario? You look for best hosting service provider. Right?
So what is best option to host your django app?
We tried multiple hosting providers and found out that best choice for a django app is pythonanywhere.com. why? Find out below.
Continue reading “How to host django app on pythonanywhere for free”