Remove kolo & fix debug toolbar only in debug

This commit is contained in:
Gabriel Augendre 2022-12-19 22:23:20 +01:00
parent 2590be0690
commit dd186a67dd
5 changed files with 22 additions and 95 deletions

View file

@ -27,7 +27,6 @@ module = [
"django_otp.plugins.otp_totp.models",
"model_bakery",
"invoke",
"kolo",
]
ignore_missing_imports = true

View file

@ -14,7 +14,6 @@ types-requests>=2.26.3
types-toml>=0.10.1
types-beautifulsoup4>=4.10.7
types-Pillow>=9.2
kolo>=2.0.3
lxml-stubs>=0.4.0
django-debug-toolbar>=3.2
bpython>=0.22.1

View file

@ -24,9 +24,6 @@ bpython==0.23 \
--hash=sha256:72aab438052439ac89b471c4ee2a8fba6a0a082a51b0f70826e88cc0e7723298 \
--hash=sha256:9f0078abc887c48af088691e2f64797d6ca994ac0f4bc03c38d06f657d7c052a
# via -r requirements-dev.in
cerberus==1.3.4 \
--hash=sha256:d1b21b3954b2498d9a79edf16b3170a3ac1021df88d197dc2ce5928ba519237c
# via kolo
certifi==2022.12.7 \
--hash=sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3 \
--hash=sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18
@ -43,10 +40,6 @@ charset-normalizer==2.1.1 \
# via
# -c constraints.txt
# requests
click==8.1.3 \
--hash=sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e \
--hash=sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48
# via kolo
coverage[toml]==7.0.0 \
--hash=sha256:0a8b0e86bede874bf5da566b02194fbb12dd14ce3585cabd58452007f272ba81 \
--hash=sha256:100546219af59d2ad82d4575de03a303eb27b75ea36ffbd1677371924d50bcbc \
@ -224,9 +217,9 @@ greenlet==2.0.1 \
--hash=sha256:f6327b6907b4cb72f650a5b7b1be23a2aab395017aa6f1adb13069d66360eb3f \
--hash=sha256:fb412b7db83fe56847df9c47b6fe3f13911b06339c2aa02dcc09dce8bbf582cd
# via bpython
identify==2.5.10 \
--hash=sha256:dce9e31fee7dbc45fea36a9e855c316b8fbf807e65a862f160840bb5a2bf5dfd \
--hash=sha256:fb7c2feaeca6976a3ffa31ec3236a6911fbc51aec9acc111de2aed99f244ade2
identify==2.5.11 \
--hash=sha256:14b7076b29c99b1b0b8b08e96d448c7b877a9b07683cd8cfda2ea06af85ffa1c \
--hash=sha256:e7db36b772b188099616aaf2accbee122949d1c6a1bac4f38196720d6f9f06db
# via pre-commit
idna==3.4 \
--hash=sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4 \
@ -243,65 +236,6 @@ invoke==1.7.3 \
--hash=sha256:41b428342d466a82135d5ab37119685a989713742be46e42a3a399d685579314 \
--hash=sha256:d9694a865764dd3fd91f25f7e9a97fb41666e822bbb00e670091e3f43933574d
# via -r requirements-dev.in
kolo==2.3.0 \
--hash=sha256:0492f8724dc966814a9a5120348b27db9ea342e2d7b4b3aa4f75276e8b5138be \
--hash=sha256:067e2ade6d4ed9a77f717f80d44d836b9795e43c25fd4ee11306188457067b02 \
--hash=sha256:099b257004127d5c62a2d91fea325956b1dc76603f0e2b414c5b16c4452eeacb \
--hash=sha256:0ff447925f523cad0dfc4282ebc8368908d1da95acc191442e86f336e97799b8 \
--hash=sha256:1580936a8353ac0ef7c3f6a0bd2bb3745a6f284f3a1d4e215ddb0ec9d7d4a6a0 \
--hash=sha256:15f8a08761969af6924e9d62da14f300e78db73a3e51c7a542866e40bccf874a \
--hash=sha256:19438347873aad16a9a57c363efe3c49fd47509a9fc65ab89e3c0959c62f3786 \
--hash=sha256:1c5765d36d8e018c011c1b4c06cc0467094de007d534e876a76585a542966bc7 \
--hash=sha256:1f3e9943ee85f8358db93c06360d0b3f63066cd1697bdedda63a3bea33314c98 \
--hash=sha256:200ab6486f55355d4a7125e6639821f77155d24a98238c7c33ec7584577b2398 \
--hash=sha256:2dc079bd9ab0d42fcf925bf5f9fd72808157b12724a6fad758bbc56d90378e94 \
--hash=sha256:2ffc6b9881d01d28a4deb55549e610076f33e18c26f93dbc796fdcf533f7777f \
--hash=sha256:312d150b7cd0131a95b9a399afcd17dfd94a08a7ebc8671f4eda925c2a02583b \
--hash=sha256:329097748a287155ce6833236317dd673d593e876e3cd11cb48b563d03928af3 \
--hash=sha256:36199e196522e71679fca7ed50326ef5bb1b25fe8a8c4dc3d8c05a4a5d850526 \
--hash=sha256:386763c4e328d06ce41abc40c630420774ed75dac95e68ac545cfc15b66a79b8 \
--hash=sha256:3984adddb2e8cfeafd98933d4972589bbfa1e540243dcbb84102f9882c114ab9 \
--hash=sha256:39b5fb092c7181d2d3903442b87fdff8279c8bf586b9b0f6f63d479df054bdb5 \
--hash=sha256:426f21864550b2d6bcefdb94818179da94d9956a7787bb1ccc7ad26ec8dfb6ec \
--hash=sha256:43ed61cefef627fd0a442b4a9ef79b96e263e53e81772e58fc64c7f0088a2f7a \
--hash=sha256:566e372ede767a014b34a581928898f0f8de23aa2bc579d6564f839ae3dd384e \
--hash=sha256:63879b089c5021b47674861d06ec46a95b48f439353901bbad1478ffceb1f2da \
--hash=sha256:676d16f635727012d62093ada9042a558aa8e8354fb7ce3f0bc51d02f2e46bad \
--hash=sha256:6a50f2c39fadb9ff318335105daa326482629f0ffe004e387189bf3af64c0df5 \
--hash=sha256:72b9d5e134a05ff2a44ae45bd9cc41f9ec0cc79dd712381ee8a5165bdc8e0ad8 \
--hash=sha256:730d25fd6248d2253827c65d600fe3b8bbea86d25f804c7249c02be942bfa4d2 \
--hash=sha256:73bc5d4e5bcf5d6901e966852c17e20ea3d51af15a7e93c839133cb98a56563f \
--hash=sha256:779bfa50d5417e9b80ffb56f0ec48a58e3aa23557d4f13be5e65dd1d8b0b39d3 \
--hash=sha256:79d5d0cfd9cd78e786c172136be6cce49b50bbf7d38de06ffee42a730ecfe518 \
--hash=sha256:7a41f85faae6f5c64e26121a1d710d4782a720a50ecfbab8519d2271141bef49 \
--hash=sha256:7ed831b078f7fc8b3514ae7131ea00fd2959fe3dd9a28b21892d74cdd18ad5b2 \
--hash=sha256:8379ae1191c7feedbbd638418ca9a5e853bf8686d6d6a43085ead451dc337433 \
--hash=sha256:873d0f77e12040d74ad5c0aa6ec257134e61dff5ab43f480e10e10433d98a575 \
--hash=sha256:890dd2f69d26839a64e48d1aefbec7c8b8ce7ee65064c68b388ee1dab6a5f916 \
--hash=sha256:8af0a2003c3ad3b81c7b9873ee89fe01a05bcb4c63b146b9bb3528a792dcf05b \
--hash=sha256:8b92d6a08605b877f7db21b8f08873d95c9b3ac642e3a166c31b9da9a0ea1052 \
--hash=sha256:8c3f2dba89618fb97f5877e7bd10979343ab610afd96ed0fe0a14dea01a82f71 \
--hash=sha256:91abd9b72ba730134781e7aee38075a9995a103ff25525946349f4b29e408ce0 \
--hash=sha256:920d668c59a49cb7aa113c78d0639be3ef5884be296fef83fadc839024c619fb \
--hash=sha256:9421c8e5e734461bb5d84422d5edf648e228e40d2e918d1b0f8d0369d4bed0c4 \
--hash=sha256:9921588ab2ed6237efef6f6b1cf2e21c9c930ad80f22cec2295bc88d5c991898 \
--hash=sha256:9fc4db1ea48844341bc1c683248cee6481a22f3cab38062d3ba1bedd4a548098 \
--hash=sha256:a2dd80620f7be3a6d8441298adff5d70ecc3fab260501eecbc04d6d039ce4e0a \
--hash=sha256:a495d6c634af19f1fb1501b820747bb2b08b5c08c2dc9a72e173ec40e1eef1d4 \
--hash=sha256:a706c7dbe33a3b2b7b7ced2027352fd499b1c36140ec315d8c495b963f29a9a5 \
--hash=sha256:aee5248e1af4b609e3ed9e20c74acc7ae5897f580711bfbb2ad100751f7a0a80 \
--hash=sha256:af9867064275379e3139877926fe6a528748df94a2c71b65b20c9715cc305644 \
--hash=sha256:b171e18fdffe5217cc0a7a5aa28e67fdd17f622c8a246742c5b25cada789ad26 \
--hash=sha256:b2e06262b4cda4dc6273f03c15048ba8d5045486dab81408a0964095fccdb2f3 \
--hash=sha256:c2f8e2b829f0d81d5f4c534f53511a5573372c4b5621f37517394592646df30a \
--hash=sha256:c45ed9b97d8c00dadeaf43f8820dbb68decdb2922669c6f5feff037ff60a7333 \
--hash=sha256:c8b1ffd9d8c1ff3af4f98618da8c3bbd529c3cf45ccdb761f2414bca2e9107b5 \
--hash=sha256:ca969a3a02a86d915081663cd5a2540fae8b9e0f4a1c3dcc2fb12971eb3602d3 \
--hash=sha256:cce7f0f8fc35309ac6a48c4f45e0794e1022b11b301dfa37180032ddbecb2bfc \
--hash=sha256:e54dc71423a073d6a8121ef0832d2d4f3134609ef4cfd842bc57637a9f09ac2e \
--hash=sha256:e97c911304fd3a095b5decda7cd0126f1a60a529b71f50c5d24664a0dee30839 \
--hash=sha256:f6ace6d8eae43ffe957d22b28f61c4a14e3cd0472a77a7918df90f535080c381
# via -r requirements-dev.in
lxml-stubs==0.4.0 \
--hash=sha256:184877b42127256abc2b932ba8bd0ab5ea80bd0b0fee618d16daa40e0b71abee \
--hash=sha256:3b381e9e82397c64ea3cc4d6f79d1255d015f7b114806d4826218805c10ec003
@ -539,7 +473,6 @@ setuptools==65.6.3 \
--hash=sha256:a7620757bf984b58deaf32fc8a4577a9bbc0850cf92c20e1ce41c38c19e5fb75
# via
# -c constraints.txt
# cerberus
# nodeenv
six==1.16.0 \
--hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \
@ -558,10 +491,6 @@ toml==0.10.2 \
--hash=sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b \
--hash=sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f
# via pre-commit
toolz==0.12.0 \
--hash=sha256:2059bd4148deb1884bb0eb770a3cde70e7f954cfbbdc2285f1f2de01fd21eb6f \
--hash=sha256:88c570861c440ee3f2f6037c4654613228ff40c93a6c25e0eba70d17282c6194
# via kolo
types-beautifulsoup4==4.11.6.1 \
--hash=sha256:c1f803367a2b07ad4fdac40ddbea557010dc4ddd1ee92d801f317eb02e2e3c72 \
--hash=sha256:d46be8f409ddccb6daaa9d118484185e70bcf552085c39c6d05b157cd1462e04
@ -590,10 +519,6 @@ typing-extensions==4.4.0 \
--hash=sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa \
--hash=sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e
# via mypy
ulid-py==1.1.0 \
--hash=sha256:b56a0f809ef90d6020b21b89a87a48edc7c03aea80e5ed5174172e82d76e3987 \
--hash=sha256:dc6884be91558df077c3011b9fb0c87d1097cb8fc6534b11f310161afd5738f0
# via kolo
urllib3==1.26.13 \
--hash=sha256:47cc05d99aaa09c9e72ed5809b60e7ba354e64b59c9c173ac3018642d8bb41fc \
--hash=sha256:c083dd0dce68dbfbe1129d5271cb90f9447dea7d52097c6e0126120c521ddea8

View file

@ -73,28 +73,36 @@ SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
SESSION_COOKIE_SECURE = not DEBUG
CSRF_COOKIE_SECURE = not DEBUG
# Application definition
INSTALLED_APPS = [
"whitenoise.runserver_nostatic",
DJANGO_APPS = [
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"articles",
"attachments",
]
EXTERNAL_APPS = [
"anymail",
"django_extensions",
"django_cleanup.apps.CleanupConfig",
"debug_toolbar",
"django_otp",
"django_otp.plugins.otp_static",
"django_otp.plugins.otp_totp",
"two_factor",
"django_cleanup.apps.CleanupConfig", # should be last: https://pypi.org/project/django-cleanup/
]
if DEBUG:
EXTERNAL_APPS.insert(-2, "debug_toolbar")
CUSTOM_APPS = [
"whitenoise.runserver_nostatic", # should be first
"articles",
"attachments",
]
INSTALLED_APPS = CUSTOM_APPS + DJANGO_APPS + EXTERNAL_APPS
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
@ -110,13 +118,8 @@ MIDDLEWARE = [
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"csp.middleware.CSPMiddleware",
]
try:
import kolo
MIDDLEWARE = ["kolo.middleware.KoloMiddleware"] + MIDDLEWARE
except ImportError:
pass # do nothing
if DEBUG:
MIDDLEWARE.insert(0, "debug_toolbar.middleware.DebugToolbarMiddleware")
ROOT_URLCONF = "blog.urls"

View file

@ -13,7 +13,6 @@ Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
import debug_toolbar # type: ignore
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import include, path
@ -36,5 +35,7 @@ urlpatterns = [
]
if settings.DEBUG:
import debug_toolbar # type: ignore
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += [path("__debug__/", include(debug_toolbar.urls))]