from django.contrib.auth.models import User


class UserProfile(models.Model):
    user = models.ForeignKey(User, unique=True)
token = models.CharField(max_length=100, blank=True)
How can I set up token-based authentication for web services using Python?