diff --git a/egypt_metro/settings.py b/egypt_metro/settings.py index b36e675..fa42cb5 100644 --- a/egypt_metro/settings.py +++ b/egypt_metro/settings.py @@ -100,14 +100,26 @@ ] CORS_ALLOW_CREDENTIALS = True # Allow credentials -if ENVIRONMENT == "dev": - INSTALLED_APPS += ["silk"] - MIDDLEWARE += ["silk.middleware.SilkyMiddleware"] - - SILKY_PYTHON_PROFILER = True # Enables Python code profiling - SILKY_MAX_REQUESTS = 1000 # Limit the number of requests to profile - SILKY_RECORD_SQL = True # Records SQL queries - SILKY_AUTHENTICATION = True # Protect Silk interface with authentication +# if ENVIRONMENT == "dev": +# INSTALLED_APPS += [ +# "silk", +# "debug_toolbar", +# ] +# MIDDLEWARE += [ +# "silk.middleware.SilkyMiddleware", +# "debug_toolbar.middleware.DebugToolbarMiddleware", +# ] + +# INTERNAL_IPS = [ +# "127.0.0.1", # Localhost +# "localhost", # Localhost +# "0.0.0.0", # Docker/Container or VM access +# ] + +# SILKY_PYTHON_PROFILER = True # Enables Python code profiling +# SILKY_MAX_REQUESTS = 1000 # Limit the number of requests to profile +# SILKY_RECORD_SQL = True # Records SQL queries +# SILKY_AUTHENTICATION = True # Protect Silk interface with authentication TEMPLATES = [ { @@ -325,10 +337,6 @@ SESSION_EXPIRE_AT_BROWSER_CLOSE = ENVIRONMENT == "dev" # True for development, False for production SESSION_SAVE_EVERY_REQUEST = True # Save session data on every request -INTERNAL_IPS = [ - "127.0.0.1", # Localhost -] - HANDLER404 = "egypt_metro.views.custom_404" # Custom 404 handler HANDLER500 = "egypt_metro.views.custom_500" # Custom 500 handler diff --git a/egypt_metro/urls.py b/egypt_metro/urls.py index a2e5831..0533cbc 100644 --- a/egypt_metro/urls.py +++ b/egypt_metro/urls.py @@ -78,9 +78,6 @@ ), # Swagger UI path("redoc/", schema_view.with_ui("redoc", cache_timeout=0), name="schema-redoc"), # ReDoc - - # Silk Profiling - path("silk/", include("silk.urls", namespace="silk")) if settings.ENVIRONMENT == "dev" else None, ] # Debug the URL loading process @@ -88,8 +85,12 @@ # Debug Toolbar (only for development) # if settings.DEBUG: +# import debug_toolbar # type: ignore + # urlpatterns += [ -# path("__debug__/", include("debug_toolbar.urls")), # Debug toolbar +# path('__debug__/', include(debug_toolbar.urls)), # Debug toolbar +# static(settings.STATIC_URL, document_root=settings.STATIC_ROOT), +# path("silk/", include("silk.urls", namespace="silk")) # ] # Static and media files (if DEBUG is enabled) diff --git a/poetry.lock b/poetry.lock index 59e1e6a..9ad0482 100644 --- a/poetry.lock +++ b/poetry.lock @@ -668,6 +668,21 @@ files = [ [package.dependencies] django = ">=3.1" +[[package]] +name = "django-debug-toolbar" +version = "4.4.6" +description = "A configurable set of panels that display various debug information about the current request/response." +optional = false +python-versions = ">=3.8" +files = [ + {file = "django_debug_toolbar-4.4.6-py3-none-any.whl", hash = "sha256:3beb671c9ec44ffb817fad2780667f172bd1c067dbcabad6268ce39a81335f45"}, + {file = "django_debug_toolbar-4.4.6.tar.gz", hash = "sha256:36e421cb908c2f0675e07f9f41e3d1d8618dc386392ec82d23bcfcd5d29c7044"}, +] + +[package.dependencies] +django = ">=4.2.9" +sqlparse = ">=0.2" + [[package]] name = "django-environ" version = "0.11.2" @@ -2487,4 +2502,4 @@ brotli = ["brotli"] [metadata] lock-version = "2.0" python-versions = ">=3.10,<4.0" -content-hash = "2fe26946fa371266bea1ba06d1af65ccf1b38b1d48d01055aa2328cfb6ec4b27" +content-hash = "c1b86f845e320f9f39acfdf2d13ffd30e005435a14af6cbb58c6e9cd0c315094" diff --git a/pyproject.toml b/pyproject.toml index b37a187..3d2bd68 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -115,6 +115,7 @@ django-db-geventpool = "^4.0.7" django-silk = "^5.3.2" django-constance = "^4.1.3" simplejwt = "^2.0.1" +django-debug-toolbar = "^4.4.6" [tool.poetry.dev-dependencies] pytest = "^6.2.4" # Pytest for unit testing pytest-asyncio = "^0.15.1" # Pytest plugin for asyncio tests diff --git a/requirements.txt b/requirements.txt index b6438b8..c67530f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,6 +22,7 @@ django-allauth==65.3.0 ; python_version >= "3.10" and python_version < "4.0" django-constance==4.1.3 ; python_version >= "3.10" and python_version < "4.0" django-cors-headers==4.6.0 ; python_version >= "3.10" and python_version < "4.0" django-db-geventpool==4.0.7 ; python_version >= "3.10" and python_version < "4.0" +django-debug-toolbar==4.4.6 ; python_version >= "3.10" and python_version < "4.0" django-environ==0.11.2 ; python_version >= "3.10" and python_version < "4" django-redis==5.4.0 ; python_version >= "3.10" and python_version < "4.0" django-silk==5.3.2 ; python_version >= "3.10" and python_version < "4.0"