<commit_before># Django settings for humbug project.
#
# DO NOT PUT ANY SECRETS IN THIS FILE.
# Those belong in local_settings.py.
import os
import platform
import time
import sys
import ConfigParser

from zerver.openid import openid_failure_handler

config_file = ConfigParser.RawConfigParser()
config_file.read("/etc/zulip/zulip.conf")

# Whether we're running in a production environment. Note that DEPLOYED does
# **not** mean hosted by us; customer sites are DEPLOYED and ENTERPRISE
# and as such should not for example assume they are the main Zulip site.
DEPLOYED = config_file.has_option('machine', 'deploy_type')
STAGING_DEPLOYED = DEPLOYED and config_file.get('machine', 'deploy_type') == 'staging'
TESTING_DEPLOYED = DEPLOYED and config_file.get('machine', 'deploy_type') == 'test'

ENTERPRISE = DEPLOYED and config_file.get('machine', 'deploy_type') == 'enterprise'

# Import variables like secrets from the local_settings file
# Import local_settings after determining the deployment/machine type
from local_settings import *

SERVER_GENERATION = int(time.time())

if not 'DEBUG' in globals():
    # Uncomment end of next line to test JS/CSS minification.
    DEBUG = not DEPLOYED # and platform.node() != 'your-machine'

TEMPLATE_DEBUG = DEBUG
TEST_SUITE = False

if DEBUG:
    INTERNAL_IPS = ('127.0.0.1',)
if TESTING_DEPLOYED or ENTERPRISE:
    # XXX we should probably tighten this for ENTERPRISE
    # Allow any hosts for our test instances, to reduce 500 spam
    ALLOWED_HOSTS = ['*']
elif DEPLOYED:
    # The IP addresses are for app.zulip.{com,net} and staging.zulip.{com,net}
    ALLOWED_HOSTS = ['localhost', '.humbughq.com', '192.168.127.12', '192.168.127.12',
                     '172.16.17.32', '192.168.127.12', '192.168.3.11',
                     '192.168.3.11', '172.16.31.10', '.zulip.com', '.zulip.net']
else:
    ALLOWED_HOSTS = ['localhost']

DATABASES = {"default": {
    'ENGINE': 'django.db.backends.postgresql_psycopg2',
    'NAME': 'zulip',
    'USER': 'zulip',
    'PASSWORD': '', # Authentication done via certificates
    'HOST': 'postgres.zulip.net',
    'SCHEMA': 'zulip',
    'CONN_MAX_AGE': 600,
    'OPTIONS': {
        'sslmode': 'verify-full',
        'autocommit': True,
        },
    },
}

if ENTERPRISE:
    DATABASES["default"].update({
            # Host = '' => connect through a local socket
            'HOST': '',
            'OPTIONS': {
                'autocommit': True,
            }
            })
elif not DEPLOYED:
    DATABASES["default"].update({<commit_msg>settings: Add some new IP addresses to ALLOWED_HOSTS.<commit_after># Django settings for humbug project.
#
# DO NOT PUT ANY SECRETS IN THIS FILE.
# Those belong in local_settings.py.
import os
import platform
import time
import sys
import ConfigParser

from zerver.openid import openid_failure_handler

config_file = ConfigParser.RawConfigParser()
config_file.read("/etc/zulip/zulip.conf")

# Whether we're running in a production environment. Note that DEPLOYED does
# **not** mean hosted by us; customer sites are DEPLOYED and ENTERPRISE
# and as such should not for example assume they are the main Zulip site.
DEPLOYED = config_file.has_option('machine', 'deploy_type')
STAGING_DEPLOYED = DEPLOYED and config_file.get('machine', 'deploy_type') == 'staging'
TESTING_DEPLOYED = DEPLOYED and config_file.get('machine', 'deploy_type') == 'test'

ENTERPRISE = DEPLOYED and config_file.get('machine', 'deploy_type') == 'enterprise'

# Import variables like secrets from the local_settings file
# Import local_settings after determining the deployment/machine type
from local_settings import *

SERVER_GENERATION = int(time.time())

if not 'DEBUG' in globals():
    # Uncomment end of next line to test JS/CSS minification.
    DEBUG = not DEPLOYED # and platform.node() != 'your-machine'

TEMPLATE_DEBUG = DEBUG
TEST_SUITE = False

if DEBUG:
    INTERNAL_IPS = ('127.0.0.1',)
if TESTING_DEPLOYED or ENTERPRISE:
    # XXX we should probably tighten this for ENTERPRISE
    # Allow any hosts for our test instances, to reduce 500 spam
    ALLOWED_HOSTS = ['*']
elif DEPLOYED:
    # The IP addresses are for app.zulip.{com,net} and staging.zulip.{com,net}
    ALLOWED_HOSTS = ['localhost', '.humbughq.com', '192.168.127.12', '192.168.127.12',
                     '172.16.17.32', '192.168.127.12', '192.168.3.11',
                     '172.16.31.10', '192.168.3.11', '172.16.58.3',
                     '192.168.3.11', '172.16.31.10', '.zulip.com', '.zulip.net']
else:
    ALLOWED_HOSTS = ['localhost']

DATABASES = {"default": {
    'ENGINE': 'django.db.backends.postgresql_psycopg2',
    'NAME': 'zulip',
    'USER': 'zulip',
    'PASSWORD': '', # Authentication done via certificates
    'HOST': 'postgres.zulip.net',
    'SCHEMA': 'zulip',
    'CONN_MAX_AGE': 600,
    'OPTIONS': {
        'sslmode': 'verify-full',
        'autocommit': True,
        },
    },
}

if ENTERPRISE:
    DATABASES["default"].update({
            # Host = '' => connect through a local socket
            'HOST': '',
            'OPTIONS': {
                'autocommit': True,
            }
            })
elif not DEPLOYED:
    DATABASES["default"].update({
{'fraction_non_alphanumeric': 0.129694154084398, 'fraction_numerical': 0.03677893921796361, 'mean_word_length': 3.334731543624161, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 19, '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': '2808914', 'n_tokens_mistral': 1900, 'n_tokens_neox': 1728, 'n_words': 469}