How to return the response from an asynchronous call?

I tried to return the value from the success callback as well as assigning the response to a local variable inside the function and return that one, but none of those ways actually return the response.

Synchronous

Imagine you make a phone call to a friend and ask him to look something up for you. Although it might take a while, you wait on the phone and stare into space, until your friend gives you the answer you needed.

Asynchronous

You call your friend again for the same reason. But this time you tell him that you are in a hurry and he should call you back on your mobile phone. You hang up, leave the house and do whatever you planned to do. Once your friend calls you back, you are dealing with the information he gave to you.

Solution(s)

Embrace the asynchronous nature of JavaScript! While certain asynchronous operations provide synchronous counterparts (so does “Ajax”), it’s generally discouraged to use them, especially in a browser context.

django-taggit

Then you can use the API like so:

>>> apple = Food.objects.create(name=”apple”)
>>> apple.tags.add(“red”, “green”, “delicious”)
>>> apple.tags.all()
[, , ]
>>> apple.tags.remove(“green”)
>>> apple.tags.all()
[, ]
>>> Food.objects.filter(tags__name__in=[“red”])
[, ]

Deploy django apps to Amazon EC2 with ONE command

Fabulous will create an EC2 instance, install everything and deploy a blank django app. All in less than 2 minutes.

Process

Create server on EC2
Wait a few seconds for server to boot
Install packages
Create virtualenv
Install django in virtualenv
Install gunicorn in virtualenv
Setup and run supervisor
The setup

nginx
gunicorn
supervisor
memcached
virtualenv
virtualenvwrapper
git