Conhecendo settings.py
As principais configurações das quais todo projeto depende
Conhecendo settings.py é uma aula grátis de Django Academy no CoddyKit. Esta é a aula 3 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.
One File, Whole Project
The settings.py file is the control panel for your entire project. Nearly every Django behavior is configured from this one place. 🎛️
It Is Just Python
Settings are plain Python variables, so you can compute them with code. That flexibility is powerful, but it means typos break startup loudly.
BASE_DIR Anchors Paths
BASE_DIR points to your project root. Other settings build paths from it so your app works no matter where it is installed.
BASE_DIR = Path(__file__).resolve().parent.parentDEBUG Controls Detail
DEBUG shows rich error pages while you build. You must set it to False in production, or you leak sensitive details to visitors. ⚠️
DEBUG = TrueSECRET_KEY Signs Things
The SECRET_KEY secures sessions, cookies, and password resets. Keep it private and never commit the real one to version control.
ALLOWED_HOSTS Guards Access
ALLOWED_HOSTS lists the domains your site may serve. It blocks requests with a faked Host header, an important safety check.
ALLOWED_HOSTS = ["example.com"]INSTALLED_APPS Lives Here
The familiar INSTALLED_APPS list sits in settings too. It declares which apps, yours and Django's, are active in this project.
MIDDLEWARE Wraps Requests
The MIDDLEWARE list defines layers that process every request and response, handling things like security and sessions in order.
DATABASES Defines Storage
The DATABASES setting tells Django where to store data. New projects start with SQLite, a simple file-based database.
DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3"}}TEMPLATES and Static
TEMPLATES configures HTML rendering, while STATIC_URL sets where CSS and JS are served from. Both shape how pages reach the browser.
Locale and Time
Settings like TIME_ZONE and LANGUAGE_CODE control formatting and translation, so your app feels right for its users worldwide. 🌍
TIME_ZONE = "UTC"Quick Check
Which setting must be False before you go live?
Recap: You Know the Panel
You toured settings.py: BASE_DIR, DEBUG, SECRET_KEY, ALLOWED_HOSTS, apps, middleware, and databases. This file steers the whole project. 🧭
Perguntas Frequentes
A aula “Conhecendo settings.py” é grátis?
Sim — o texto completo de “Conhecendo settings.py” é 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 “Conhecendo settings.py”?
As principais configurações das quais todo projeto depende 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 3 de 4.
Quanto tempo leva a aula “Conhecendo settings.py”?
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
- startapp e a Estrutura de Pastas do Aplicativo
- Registre Aplicativos em INSTALLED_APPS
- Conhecendo settings.py
- manage.py: Seu Centro de Comandos