diff --git a/conf.py b/conf.py index 3d8b4c2..e930832 100644 --- a/conf.py +++ b/conf.py @@ -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' diff --git a/default_conf.py b/default_conf.py index 3c42a1e..dcc8190 100644 --- a/default_conf.py +++ b/default_conf.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + import os # Default configuration diff --git a/iwla.py b/iwla.py index 9eade1c..0c0f331 100755 --- a/iwla.py +++ b/iwla.py @@ -240,11 +240,10 @@ 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()) + fzip.write(f.read()) os.remove(filename + '.tmp') def _deserialize(self, filename): @@ -485,9 +484,8 @@ 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: - f_out.write(f_in.read()) + 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): if not conf.compress_output_files: return