Google Webmaster or Authentication with Django

 : 149 words

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.

comments powered by Disqus