Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurado Django Debug Toolbar #49

Merged
merged 1 commit into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dj-database-url = "*"
psycopg2-binary = "*"
django-s3-folder-storage = "*"
collectfast = "*"
django-debug-toolbar = "*"

[dev-packages]
flake8 = "*"
Expand Down
11 changes: 10 additions & 1 deletion Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion contrib/env-sample
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ DATABASE_URL=postgres://postgres:postgres@localhost/postgres
# Configuração do AWS
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_STORAGE_BUCKET_NAME=
AWS_STORAGE_BUCKET_NAME=
INTERNAL_IPS=127.0.0.1
2 changes: 1 addition & 1 deletion pypro/base/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@


def home(request):
return HttpResponse('Olá Django')
return HttpResponse('<html><body>Olá Django</body></html>', content_type='text/html; charset=utf-8')
8 changes: 8 additions & 0 deletions pypro/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@
WSGI_APPLICATION = 'pypro.wsgi.application'


# Configuração Django Debug Toolbar

INTERNAL_IPS = config('INTERNAL_IPS', cast=Csv(), default='127.0.0.1')

if DEBUG:
INSTALLED_APPS.append('debug_toolbar')
MIDDLEWARE.insert(0, 'debug_toolbar.middleware.DebugToolbarMiddleware')

Check warning on line 86 in pypro/settings.py

View check run for this annotation

Codecov / codecov/patch

pypro/settings.py#L85-L86

Added lines #L85 - L86 were not covered by tests

# Database
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases

Expand Down
11 changes: 10 additions & 1 deletion pypro/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,21 @@
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.conf import settings
from django.contrib import admin
from django.urls import path
from django.urls import include, path

from pypro.base.views import home

urlpatterns = [
path('admin/', admin.site.urls),
path('', home),
]


# Configuração Django Debug Toolbar

if settings.DEBUG:
urlpatterns.append(

Check warning on line 31 in pypro/urls.py

View check run for this annotation

Codecov / codecov/patch

pypro/urls.py#L31

Added line #L31 was not covered by tests
path('__debug__/', include('debug_toolbar.urls'))
)
Loading