def card_create(request): packIdToNumber = None if request.method == 'POST': if request.POST['packId'] == 'friendship': packIdToNumber = 1 if request.POST['packId'] == 'relationship': packIdToNumber = 2 if request.POST['packId'] == 'family': packIdToNumber = 3 card = Card() card.packId = packIdToNumber card.cardText = request.POST['cardText'] card.author = request.user card.save() tasks.echo('****** This is the newly added card: ' + request.POST['cardText']) return redirect('cards:openPack') else: return render(request, 'playcards/card_create.html')
import logging logging.basicConfig(level=logging.INFO) logging.getLogger('pika').level = logging.INFO from tasks import echo # Since echo method is wrapped with task decorator # it is going to be send to queue to run in background. echo('hello world')
#!/usr/bin/env python import tasks tasks.echo("Hello Kuyruk")