code: def backup_db():
      
      if not os.path.exists('backups'):
          os.makedirs('backups')
      local('python manage.py dump_database | gzip > backups/' + _sql_paths('local', datetime.now()))
docs: Backup local database