How to backup database periodically on PythonAnyWhere server

You can host your Django app effortlessly on PythonAnyWhere server. If you are using the database in your app then it is strongly recommended to take backup of database to avoid loss of data.

This PythonAnyWhere article explain the process to take sql dump. We will extend the same article to take database backup periodically and delete the old files.

Continue reading “How to backup database periodically on PythonAnyWhere server”

List of USA states in Python-Django format

In one of previous article we released the list of Indian states in different formats (CSV, List, Set, Model Choice, HTMLSelect) to be used in python-django project. We received few requests to release the USA states in same format. So here we are, presenting to you the states of USA in different Python-Django format.

Continue reading “List of USA states in Python-Django format”

List of Indian States in Python Format

So I was working on a project where I needed list of Indian States in Python format. I looked around on the web but the data was not available in required format. So I decided to create the list of Indian states in different formats which can be used directly in Python-Django project.

You can simply copy paste the data in any of the below format.

Continue reading “List of Indian States in Python Format”

Creating custom user model and custom authentication 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”