Google Webmaster or Authentication with Django

This will be just a quick post. Sometimes you have to prove your ownership of a domain. This is true when you sign up for Google Web Master Tools or want to run a test with Google and give you a long hexadecimal string that you have to respond to from your site.

In the case of they give you a string that needs to respond with ’42’. If you are running django you can do this very quickly and easily. In the main project folder in the file:

#import HttpResponse
from django.http import HttpResponse

#in the url list add
url(r'^mu-your_hexadecimal_number', lambda r: HttpResponse('42')),

That’s it. I know this kind of breaks separating out views, but this is usually a one time thing. After verifying you can remove this line. I do not really see any sense in creating a view to return two characters.

Enjoyed the article?

Then I guarantee that you will find my video series useful and enjoyable. The course focuses on taking someone completely new to Node.js and giving them a great foundation to start building real applications. The course is named The Complete Guide to Node.js.

Feel comfortable with Node.js and want to build web applications? Then you will find my other video series useful. It is named Building Complex Express Sites with Redis and

I also have a book! It covers Node.js, Express, Passport, Socket.IO, Redis, RabbitMQ, React, Backbone, Grunt, and Ansible. All in one book! It is called Building Scalable Apps with Redis and Node.js.

Receive tips on Node.js, Python, and more