-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
79 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
[flake8] | ||
# E501: Line length is enforced by Black, so flake8 doesn't need to check it | ||
# W503: Black disagrees with this rule, as does PEP 8; Black wins | ||
ignore = E501, W503 | ||
exclude = | ||
ignore = | ||
E501, # Line length is enforced by Black, so flake8 doesn't need to check it | ||
W503 # Black disagrees with this rule, as does PEP 8; Black wins | ||
exclude = | ||
__pycache__, | ||
.venv, | ||
tests/inputs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ rules: | |
quote-type: "double" | ||
ignore: | | ||
.venv/ | ||
compose.yaml |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,129 +1,2 @@ | ||
"""Nautobot development configuration file.""" | ||
import os | ||
import sys | ||
|
||
from nautobot.core.settings import * # noqa: F403 # pylint: disable=wildcard-import,unused-wildcard-import | ||
from nautobot.core.settings_funcs import is_truthy, parse_redis_connection | ||
|
||
# | ||
# Debug | ||
# | ||
|
||
DEBUG = is_truthy(os.getenv("NAUTOBOT_DEBUG", False)) | ||
_TESTING = len(sys.argv) > 1 and sys.argv[1] == "test" | ||
|
||
if DEBUG and not _TESTING: | ||
DEBUG_TOOLBAR_CONFIG = {"SHOW_TOOLBAR_CALLBACK": lambda _request: True} | ||
|
||
if "debug_toolbar" not in INSTALLED_APPS: # noqa: F405 | ||
INSTALLED_APPS.append("debug_toolbar") # noqa: F405 | ||
if "debug_toolbar.middleware.DebugToolbarMiddleware" not in MIDDLEWARE: # noqa: F405 | ||
MIDDLEWARE.insert(0, "debug_toolbar.middleware.DebugToolbarMiddleware") # noqa: F405 | ||
|
||
# | ||
# Misc. settings | ||
# | ||
|
||
ALLOWED_HOSTS = os.getenv("NAUTOBOT_ALLOWED_HOSTS", "").split(" ") | ||
SECRET_KEY = os.getenv("NAUTOBOT_SECRET_KEY", "") | ||
|
||
# | ||
# Database | ||
# | ||
|
||
nautobot_db_engine = os.getenv("NAUTOBOT_DB_ENGINE", "django.db.backends.postgresql") | ||
default_db_settings = { | ||
"django.db.backends.postgresql": { | ||
"NAUTOBOT_DB_PORT": "5432", | ||
}, | ||
"django.db.backends.mysql": { | ||
"NAUTOBOT_DB_PORT": "3306", | ||
}, | ||
} | ||
DATABASES = { | ||
"default": { | ||
"NAME": os.getenv("NAUTOBOT_DB_NAME", "nautobot"), # Database name | ||
"USER": os.getenv("NAUTOBOT_DB_USER", ""), # Database username | ||
"PASSWORD": os.getenv("NAUTOBOT_DB_PASSWORD", ""), # Database password | ||
"HOST": os.getenv("NAUTOBOT_DB_HOST", "localhost"), # Database server | ||
"PORT": os.getenv( | ||
"NAUTOBOT_DB_PORT", default_db_settings[nautobot_db_engine]["NAUTOBOT_DB_PORT"] | ||
), # Database port, default to postgres | ||
"CONN_MAX_AGE": int(os.getenv("NAUTOBOT_DB_TIMEOUT", 300)), # Database timeout | ||
"ENGINE": nautobot_db_engine, | ||
} | ||
} | ||
|
||
# Ensure proper Unicode handling for MySQL | ||
if DATABASES["default"]["ENGINE"] == "django.db.backends.mysql": | ||
DATABASES["default"]["OPTIONS"] = {"charset": "utf8mb4"} | ||
|
||
# | ||
# Redis | ||
# | ||
|
||
# The django-redis cache is used to establish concurrent locks using Redis. | ||
CACHES = { | ||
"default": { | ||
"BACKEND": "django_redis.cache.RedisCache", | ||
"LOCATION": parse_redis_connection(redis_database=0), | ||
"TIMEOUT": 300, | ||
"OPTIONS": { | ||
"CLIENT_CLASS": "django_redis.client.DefaultClient", | ||
}, | ||
} | ||
} | ||
|
||
# | ||
# Celery settings are not defined here because they can be overloaded with | ||
# environment variables. By default they use `CACHES["default"]["LOCATION"]`. | ||
# | ||
|
||
# | ||
# Logging | ||
# | ||
|
||
LOG_LEVEL = "DEBUG" if DEBUG else "INFO" | ||
|
||
# Verbose logging during normal development operation, but quiet logging during unit test execution | ||
if not _TESTING: | ||
LOGGING = { | ||
"version": 1, | ||
"disable_existing_loggers": False, | ||
"formatters": { | ||
"normal": { | ||
"format": "%(asctime)s.%(msecs)03d %(levelname)-7s %(name)s :\n %(message)s", | ||
"datefmt": "%H:%M:%S", | ||
}, | ||
"verbose": { | ||
"format": "%(asctime)s.%(msecs)03d %(levelname)-7s %(name)-20s %(filename)-15s %(funcName)30s() :\n %(message)s", | ||
"datefmt": "%H:%M:%S", | ||
}, | ||
}, | ||
"handlers": { | ||
"normal_console": { | ||
"level": "INFO", | ||
"class": "logging.StreamHandler", | ||
"formatter": "normal", | ||
}, | ||
"verbose_console": { | ||
"level": "DEBUG", | ||
"class": "logging.StreamHandler", | ||
"formatter": "verbose", | ||
}, | ||
}, | ||
"loggers": { | ||
"django": {"handlers": ["normal_console"], "level": "INFO"}, | ||
"nautobot": { | ||
"handlers": ["verbose_console" if DEBUG else "normal_console"], | ||
"level": LOG_LEVEL, | ||
}, | ||
}, | ||
} | ||
|
||
# | ||
# Apps | ||
# | ||
|
||
# Enable installed Apps. Add the name of each App to the list. | ||
PLUGINS = [] | ||
SECRET_KEY = "NOTASECRET" # nosec |