<commit_before>import os, stat, sys

INSTALL_PATH = '/usr/share/libravatar/'
CONFIG_FILE = INSTALL_PATH + 'libravatar/settings.py'

# Make sure the config file is protected against unauthorized changes
if (os.stat(CONFIG_FILE).st_uid != 0) or (os.stat(CONFIG_FILE).st_gid != 0):
    print "settings.py file must be owned by root:root"
    sys.exit(1)
group_writable = bool(os.stat(CONFIG_FILE).st_mode & stat.S_IWGRP)
other_writable = bool(os.stat(CONFIG_FILE).st_mode & stat.S_IWOTH)
if group_writable or other_writable:
    print "settings.py file must only be writable by its owner"
    sys.exit(2)

os.environ['DJANGO_SETTINGS_MODULE'] = 'libravatar.settings'

if INSTALL_PATH not in sys.path:
    sys.path.append(INSTALL_PATH)

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()<commit_msg>Update to the new way to do WSGI scripts<commit_after>import os, stat, sys

INSTALL_PATH = '/usr/share/libravatar/'
CONFIG_FILE = INSTALL_PATH + 'libravatar/settings.py'

# Make sure the config file is protected against unauthorized changes
if (os.stat(CONFIG_FILE).st_uid != 0) or (os.stat(CONFIG_FILE).st_gid != 0):
    print "settings.py file must be owned by root:root"
    sys.exit(1)
group_writable = bool(os.stat(CONFIG_FILE).st_mode & stat.S_IWGRP)
other_writable = bool(os.stat(CONFIG_FILE).st_mode & stat.S_IWOTH)
if group_writable or other_writable:
    print "settings.py file must only be writable by its owner"
    sys.exit(2)

os.environ['DJANGO_SETTINGS_MODULE'] = 'libravatar.settings'

if INSTALL_PATH not in sys.path:
    sys.path.append(INSTALL_PATH)

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
{'fraction_non_alphanumeric': 0.10716400236826525, 'fraction_numerical': 0.004736530491415038, 'mean_word_length': 5.1231884057971016, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '464177', 'n_tokens_mistral': 617, 'n_tokens_neox': 590, 'n_words': 143}