Use a clear conf file

This commit is contained in:
Grégory Soutadé 2014-12-19 18:06:02 +01:00
parent a14600ccda
commit 046c1d8983
3 changed files with 14 additions and 11 deletions

13
conf.py
View File

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# Web server log
analyzed_filename = 'access.log'
analyzed_filename = '/var/log/apache2/access.log'
# Domain name to analyze
domain_name = 'soutade.fr'
@ -10,22 +11,24 @@ display_visitor_ip = True
# Hooks used
pre_analysis_hooks = ['page_to_hit', 'robots']
post_analysis_hooks = ['referers', 'top_pages', 'top_downloads', 'top_hits'] #, 'reverse_dns']
post_analysis_hooks = ['referers', 'top_pages', 'top_downloads', 'top_hits', 'reverse_dns']
display_hooks = ['top_visitors', 'all_visits', 'referers', 'top_pages', 'top_downloads', 'top_hits']
# Reverse DNS timeout
reverse_dns_timeout = 0.2
# Count this addresses as hit
page_to_hit_conf = [r'^.+/logo[/]?$']
# Count this addresses as page
hit_to_page_conf = [r'^.+/category/.+$', r'^.+/tag/.+$', r'^.+/archive/.+$', r'^.+/ljdc[/]?$']
#page_to_hit_conf = [r'^.+/logo[/]?$']
## Count this addresses as page
#hit_to_page_conf = [r'^.+/category/.+$', r'^.+/tag/.+$', r'^.+/archive/.+$', r'^.+/ljdc[/]?$']
# Because it's too long to build HTML when there is too much entries
max_hits_displayed = 100
max_downloads_displayed = 100
# Compress these files after generation
compress_output_files = ['html', 'css', 'js']
# Display result in French
locale = 'fr'

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
import os
# Default configuration

View File

@ -240,10 +240,9 @@ class IWLA(object):
# TODO : remove return
#return
with open(filename + '.tmp', 'wb+') as f:
with open(filename + '.tmp', 'wb+') as f, gzip.open(filename, 'w') as fzip:
pickle.dump(obj, f)
f.seek(0)
with gzip.open(filename, 'w') as fzip:
fzip.write(f.read())
os.remove(filename + '.tmp')
@ -485,8 +484,7 @@ class IWLA(object):
if not os.path.exists(gz_path) or\
os.stat(path).st_mtime > build_time:
with open(path, 'rb') as f_in:
with gzip.open(gz_path, 'wb') as f_out:
with open(path, 'rb') as f_in, gzip.open(gz_path, 'wb') as f_out:
f_out.write(f_in.read())
def _compressFiles(self, build_time, root):