7 from forum.models import Question
8 from forum.settings import APP_URL
10 def generate_installation_key():
11 gen = lambda length: "".join( [random.choice(string.digits+string.letters) for i in xrange(length)])
12 return '%s-%s-%s-%s' % (gen(4), gen(4), gen(4), gen(4))
14 # To get the site views count we get the SUM of all questions views.
18 # Go through all questions and increase the views count
19 for question in Question.objects.all():
20 views += question.view_count
24 def get_server_name():
29 request = urllib2.Request(url)
30 response = urllib2.urlopen(request)
32 # Get the response information
33 response_info = response.info()
35 server_name = re.findall("Server: (?P<server_name>.*)$", str(response_info))[0]
36 server_name = ''.join(server_name.splitlines())