title: Celery and Django simple example
body: <p>Let's take a simple Django example.</p>
  
  <p>app/models.py</p>
  
  <pre><code>from django.db import models
  from django.contrib.auth.models import User
  
  class UserProfile(models.Model):
      user = models.OneToOneField(User)
      token = models.CharField(max_length=32)
  </code></pre>
  
  <p>app/views.py</p>
  
  <pre><code>from django.http import HttpResponse
  from django.views.decorators.csrf import csrf_exempt
  from forms import RegisterForm
  from utils.utilities import create_user
  
  @csrf_exempt
  def register_view(request):
      if request.method == 'POST':
          form = RegisterForm(request.POST)
          if form.is_valid():
              create_user(form.cleaned_data)
              return HttpResponse('success')
  </code></pre>
  
  <p>utils/utilities.py</p>
  
  <pre><code>def create_user(data):
      user = User.objects.create_user(username=data['username'], email=None, password=data['password'])
      user.save()
      profile = UserProfile()
      profile.user = user
      profile.token = generate_token()
      profile.save()
  </code></pre>
  
  <p>Can somebody provide an implementation of Celery in this example? Imagine this is a large project with hundreds of requests per sec.</p>