import os from django.conf import settings # lazy init for translations _ = lambda s: s # from django.utils.translation import ugettext_lazy as _ settings.configure( PACKAGE_VERSION="dev", RELEASE_ENV="dev", MIGRATION_MODULES={"django_peeringdb": None}, INSTALLED_APPS=[ "django.contrib.auth", "django.contrib.contenttypes", "django_otp", "django_otp.plugins.otp_static", "django_otp.plugins.otp_totp", "django_otp.plugins.otp_email", "two_factor", "grappelli", "django.contrib.admin", "django.contrib.sessions", "django.contrib.sites", "django_inet", "django_peeringdb", "django_namespace_perms", "django_countries", "oauth2_provider", "peeringdb_server", "allauth", "allauth.account", "reversion", "rest_framework", "dal", "dal_select2", "corsheaders", "captcha", ], CACHES={ "default": { "BACKEND": "django.core.cache.backends.db.DatabaseCache", "LOCATION": "django_cache", } }, TEMPLATES=[ { "BACKEND": "django.template.backends.django.DjangoTemplates", "APP_DIRS": True, "DIRS": ( os.path.join( os.path.dirname(__file__), "..", "peeringdb_server", "templates" ), ), "OPTIONS": { "context_processors": [ "django.contrib.auth.context_processors.auth", "django.template.context_processors.debug", "django.template.context_processors.request", "django.template.context_processors.i18n", "django.template.context_processors.media", "django.template.context_processors.static", "django.template.context_processors.tz", "django.contrib.messages.context_processors.messages", ], }, } ], LANGUAGE_CODE="en-us", LANGUAGES=[ ("en", _("English")), ("pt", _("Portuguese")), ], USE_L10N=True, USE_I18N=True, MEDIA_URL="/m/", STATIC_URL="/s/", MIDDLEWARE=( "corsheaders.middleware.CorsMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", "django.middleware.locale.LocaleMiddleware", "django.middleware.common.CommonMiddleware", "django.middleware.csrf.CsrfViewMiddleware", "django.contrib.auth.middleware.AuthenticationMiddleware", "django.contrib.messages.middleware.MessageMiddleware", "peeringdb_server.maintenance.Middleware", ), SOUTH_TESTS_MIGRATE=False, SOUTH_SKIP_TESTS=True, AUTH_USER_MODEL="peeringdb_server.User", TABLE_PREFIX="peeringdb_", PEERINGDB_ABSTRACT_ONLY=True, COUNTRIES_OVERRIDE={"XK": _("Kosovo")}, CLIENT_COMPAT={ "client": {"min": (0, 6), "max": (0, 6, 5)}, "backends": {"django_peeringdb": {"min": (0, 6), "max": (0, 6, 5)}}, }, DATABASE_ENGINE="django.db.backends.sqlite3", DATABASES={ "default": { "ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:", }, # TODO - this is supposed to work to mimic replication # during tests, but doesnt. So instead we use the # peeringdb_server.db_router.TestRouter class instead # which just always used the default db for read and writes #'read' : { # 'ENGINE': 'django.db.backends.sqlite3', # 'NAME': ':memory:', # 'TEST' : { 'MIRROR' : 'default' } # } }, # TODO - change to peeringdb_server.db_router.DatabaseRouter # if repliation mimicing (see above) gets fixed DATABASE_ROUTERS=["peeringdb_server.db_router.TestRouter"], DEBUG=False, GUEST_GROUP_ID=1, USER_GROUP_ID=2, TEMPLATE_DEBUG=False, BASE_URL="https://localhost", PASSWORD_RESET_URL="localhost", API_CACHE_ROOT="tests/api-cache", API_CACHE_ENABLED=False, SUGGEST_ENTITY_ORG=1234, API_URL="localhost", REST_FRAMEWORK={ "DEFAULT_AUTHENTICATION_CLASSES": ( "rest_framework.authentication.BasicAuthentication", "rest_framework.authentication.SessionAuthentication", ), "DEFAULT_MODEL_SERIALIZER_CLASS": "rest_framework.serializers.HyperlinkedModelSerializer", "DEFAULT_PERMISSION_CLASSES": [ "rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly", "django_namespace_perms.rest.BasePermission", ], "DEFAULT_RENDERER_CLASSES": ("peeringdb_server.renderers.MetaJSONRenderer",), "DEFAULT_SCHEMA_CLASS": "rest_framework.schemas.coreapi.AutoSchema", }, NSP_MODE="crud", NSP_GUEST_GROUP="guest", DEBUG_EMAIL=True, TIME_ZONE="UTC", USE_TZ=True, POC_DELETION_PERIOD=30, PROTECTED_OBJECT_NOTIFICATION_PERIOD=1, AUTHENTICATION_BACKENDS=("django_namespace_perms.auth.backends.NSPBackend",), ROOT_URLCONF="mainsite.urls", LOGGING={ "version": 1, "disable_existing_loggers": True, "handlers": { "stderr": { "level": "DEBUG", "class": "logging.StreamHandler", }, }, "loggers": { "": {"handlers": ["stderr"], "level": "DEBUG", "propagate": False}, }, }, API_DOC_STR={ "retrieve": "retrieve object", "list": "list objects", "update": "update object", "delete": "delete object", "create": "create object", }, LOGIN_URL="/account/login", LOGIN_REDIRECT_URL="/", OAUTH_ENABLED=False, RECAPTCHA_PUBLIC_KEY="", EMAIL_SUBJECT_PREFIX="[test]", CORS_ORIGIN_WHITELIST=[], CORS_ALLOW_METHODS=["GET", "OPTIONS"], CORS_ALLOW_CREDENTIALS=False, DATA_QUALITY_MAX_PREFIX_V4_LIMIT=500000, DATA_QUALITY_MAX_PREFIX_V6_LIMIT=500000, DATA_QUALITY_MIN_PREFIXLEN_V4=18, DATA_QUALITY_MAX_PREFIXLEN_V4=28, DATA_QUALITY_MIN_PREFIXLEN_V6=64, DATA_QUALITY_MAX_PREFIXLEN_V6=116, DATA_QUALITY_MAX_IRR_DEPTH=3, DATA_QUALITY_MAX_SPEED=1000000, DATA_QUALITY_MIN_SPEED=100, TUTORIAL_MODE=False, CAPTCHA_TEST_MODE=True, SITE_ID=1, IXF_POSTMORTEM_LIMIT=250, IXF_NOTIFY_IX_ON_CONFLICT=True, IXF_NOTIFY_NET_ON_CONFLICT=True, IXF_TICKET_ON_CONFLICT=True, IXF_SEND_TICKETS=False, ABSTRACT_ONLY=True, GOOGLE_GEOLOC_API_KEY="AIzatest", RATELIMITS={ "view_affiliate_to_org_POST": "100/m", "resend_confirmation_mail": "2/m", "view_request_ownership_GET": "3/m", "view_username_retrieve_initiate": "2/m", "view_request_ownership_POST": "3/m", "request_login_POST": "10/m", "view_verify_POST": "2/m", "request_translation": "10/m", "view_import_ixlan_ixf_preview": "1/m", "view_import_net_ixf_postmortem": "1/m", }, MAX_USER_AFFILIATION_REQUESTS=10, MAIL_DEBUG=True, IXF_PARSE_ERROR_NOTIFICATION_PERIOD=36, IXF_IMPORTER_DAYS_UNTIL_TICKET=6, DESKPRO_URL="test", DESKPRO_KEY="test", NON_ZIPCODE_COUNTRIES={ "AE": "United Arab Emirates", "AG": "Antigua and Barbuda", "AN": "Netherlands Antilles", "AO": "Angola", "AW": "Aruba", "BF": "Burkina Faso", "BI": "Burundi", "BJ": "Benin", "BS": "Bahamas", "BW": "Botswana", "BZ": "Belize", "CD": "Congo, the Democratic Republic of the", "CF": "Central African Republic", "CG": "Congo", "CI": "Cote d'Ivoire", "CK": "Cook Islands", "CM": "Cameroon", "DJ": "Djibouti", "DM": "Dominica", "ER": "Eritrea", "FJ": "Fiji", "GD": "Grenada", "GH": "Ghana", "GM": "Gambia", "GN": "Guinea", "GQ": "Equatorial Guinea", "GY": "Guyana", "HK": "Hong Kong", "IE": "Ireland", "JM": "Jamaica", "KE": "Kenya", "KI": "Kiribati", "KM": "Comoros", "KN": "Saint Kitts and Nevis", "KP": "North Korea", "LC": "Saint Lucia", "ML": "Mali", "MO": "Macao", "MR": "Mauritania", "MS": "Montserrat", "MU": "Mauritius", "MW": "Malawi", "NR": "Nauru", "NU": "Niue", "PA": "Panama", "QA": "Qatar", "RW": "Rwanda", "SB": "Solomon Islands", "SC": "Seychelles", "SL": "Sierra Leone", "SO": "Somalia", "SR": "Suriname", "ST": "Sao Tome and Principe", "SY": "Syria", "TF": "French Southern Territories", "TK": "Tokelau", "TL": "Timor-Leste", "TO": "Tonga", "TT": "Trinidad and Tobago", "TV": "Tuvalu", "TZ": "Tanzania, United Republic of", "UG": "Uganda", "VU": "Vanuatu", "YE": "Yemen", "ZA": "South Africa", "ZW": "Zimbabwe", }, VQUEUE_USER_MAX_AGE=90, IXF_RESEND_FAILED_EMAILS=False, )