Settings
In [1]:
Copied!
"""
Django settings for project project.
Generated by 'django-admin startproject' using Django 5.1.2.
For more information on this file, see
https://docs.djangoproject.com/en/5.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/5.1/ref/settings/
"""
"""
Django settings for project project.
Generated by 'django-admin startproject' using Django 5.1.2.
For more information on this file, see
https://docs.djangoproject.com/en/5.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/5.1/ref/settings/
"""
Out[1]:
"\nDjango settings for project project.\n\nGenerated by 'django-admin startproject' using Django 5.1.2.\n\nFor more information on this file, see\nhttps://docs.djangoproject.com/en/5.1/topics/settings/\n\nFor the full list of settings and their values, see\nhttps://docs.djangoproject.com/en/5.1/ref/settings/\n"
In [2]:
Copied!
from pathlib import Path
from pathlib import Path
In [3]:
Copied!
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
--------------------------------------------------------------------------- NameError Traceback (most recent call last) Cell In[3], line 2 1 # Build paths inside the project like this: BASE_DIR / 'subdir'. ----> 2 BASE_DIR = Path(__file__).resolve().parent.parent NameError: name '__file__' is not defined
Quick-start development settings - unsuitable for production See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/
In [4]:
Copied!
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-_^l1-zjj&!=0a1waqzeu^-bc+qrc0tofm2&$2x3^s#u4=vmd8^'
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-_^l1-zjj&!=0a1waqzeu^-bc+qrc0tofm2&$2x3^s#u4=vmd8^'
In [5]:
Copied!
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
In [6]:
Copied!
ALLOWED_HOSTS = []
ALLOWED_HOSTS = []
Application definition
In [7]:
Copied!
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'app',
]
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'app',
]
In [8]:
Copied!
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
In [9]:
Copied!
ROOT_URLCONF = 'project.urls'
ROOT_URLCONF = 'project.urls'
In [10]:
Copied!
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
In [11]:
Copied!
WSGI_APPLICATION = 'project.wsgi.application'
WSGI_APPLICATION = 'project.wsgi.application'
In [12]:
Copied!
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
--------------------------------------------------------------------------- NameError Traceback (most recent call last) Cell In[12], line 4 1 DATABASES = { 2 'default': { 3 'ENGINE': 'django.db.backends.sqlite3', ----> 4 'NAME': BASE_DIR / 'db.sqlite3', 5 } 6 } NameError: name 'BASE_DIR' is not defined
Password validation https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators
In [13]:
Copied!
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
Internationalization https://docs.djangoproject.com/en/5.1/topics/i18n/
In [14]:
Copied!
LANGUAGE_CODE = 'pt-br'
LANGUAGE_CODE = 'pt-br'
In [15]:
Copied!
TIME_ZONE = 'America/Sao_Paulo'
TIME_ZONE = 'America/Sao_Paulo'
In [16]:
Copied!
USE_I18N = True
USE_I18N = True
In [17]:
Copied!
USE_TZ = True
USE_TZ = True
Static files (CSS, JavaScript, Images) https://docs.djangoproject.com/en/5.1/howto/static-files/
In [18]:
Copied!
STATIC_URL = 'static/'
STATIC_URL = 'static/'
Default primary key field type https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
In [19]:
Copied!
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'