0Pricing
Django Academy · Aula

Instalando e configurando DRF

Adicione DRF e a API navegável

Instalando e configurando DRF é uma aula grátis de Django Academy no CoddyKit. Esta é a aula 1 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de Django Academy, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de Django Academy inclui 4 aulas no total.

Partes desta aula ainda não foram traduzidas e aparecem em inglês.

A REST API, Quickly

Django REST Framework, or DRF, layers a clean toolkit on top of Django so you can turn your models into a JSON API fast. 🚀

Install the Package

You add DRF the same way you add any Python library: with pip, then pin it in requirements so teammates get the same version.

pip install djangorestframework

Register the App

DRF only wakes up once you add rest_framework to your INSTALLED_APPS list in settings.py, right alongside your own apps.

INSTALLED_APPS = [
    # ...
    'rest_framework',
]

Why INSTALLED_APPS Matters

Adding it to INSTALLED_APPS lets Django discover DRF's templates, static files, and management commands automatically.

The REST_FRAMEWORK Dict

You configure DRF through a single REST_FRAMEWORK dictionary in settings.py, keeping all of its options in one tidy place.

REST_FRAMEWORK = {
    'DEFAULT_PERMISSION_CLASSES': [],
}

Default Renderers

By default DRF can return both raw JSON and a friendly HTML view, thanks to its built-in renderers you rarely have to touch.

The Browsable API

One reason DRF feels magical is the browsable API: open an endpoint in your browser and you get a clickable, documented page. ✨

Wire Up the URLs

DRF ships login views for the browsable API; you include them in your urls.py so you can sign in while testing endpoints.

urlpatterns = [
    path('api-auth/', include('rest_framework.urls')),
]

Verify the Install

A quick way to confirm DRF is wired in is to open the Django shell and import it without errors before writing any code.

python manage.py shell
>>> import rest_framework

Keep Settings Minimal

Start with an almost empty config. You only add keys to REST_FRAMEWORK when you genuinely need a behavior changed, not before.

You Are API-Ready

With DRF installed, registered, and its URLs included, your project is now ready to expose endpoints that speak JSON to any client.

Quick Check

Where does DRF need to be listed to activate?

Recap: DRF Set Up

You pip-installed DRF, added it to INSTALLED_APPS, included its auth URLs, and confirmed the import. Your API foundation is solid. 🎉

Perguntas Frequentes

A aula “Instalando e configurando DRF” é grátis?

Sim — o texto completo de “Instalando e configurando DRF” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de Django Academy, atualize para CoddyKit PRO. O curso de Django Academy inclui 4 aulas no total.

O que vou aprender em “Instalando e configurando DRF”?

Adicione DRF e a API navegável Você pratica Django Academy com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.

Preciso ter experiência prévia para começar Django Academy?

Nenhuma experiência prévia é necessária. Django Academy no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 1 de 4.

Quanto tempo leva a aula “Instalando e configurando DRF”?

A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.

Posso escrever e executar código nesta aula de Django Academy?

Sim. Cada aula de Django Academy inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.

Todas as aulas deste curso

  1. Instalando e configurando DRF
  2. Serializadores: modelo para JSON
  3. APIView e função @api_view
  4. A API navegável e códigos de status
← Voltar para Django Academy