Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/OpenClassrooms-Student-Center/Python-OC-Lettings-FR/llms.txt

Use this file to discover all available pages before exploring further.

The application is configured in oc_lettings_site/settings.py. The sections below cover every setting that affects how Orange County Lettings runs: its database, installed apps, middleware, template loading, static files, and internationalisation.
SECRET_KEY is hardcoded in settings.py and DEBUG is set to True. Both of these must be changed before deploying to production. Expose the secret key via an environment variable and set DEBUG = False in any non-development environment.

Security settings

SECRET_KEY = 'fp$9^593hsriajg$_%=5trot9g!1qa@ew(o-1#@=&4%=hp46(s'

DEBUG = True

ALLOWED_HOSTS = []
ALLOWED_HOSTS is empty, which means Django only accepts requests from localhost / 127.0.0.1 in development. Add your domain name(s) or server IP addresses here before deploying.

Installed apps

INSTALLED_APPS = [
    'oc_lettings_site.apps.OCLettingsSiteConfig',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]
AppPurpose
oc_lettings_site.apps.OCLettingsSiteConfigThe main application — models, views, and URLs
django.contrib.adminDjango’s built-in admin interface
django.contrib.authAuthentication framework; provides the User model
django.contrib.contenttypesContent-type framework used internally by other apps
django.contrib.sessionsServer-side session management
django.contrib.messagesFlash message framework
django.contrib.staticfilesStatic file collection and serving

Middleware

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 is applied in order for each request and in reverse order for each response.

Database

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'oc-lettings-site.sqlite3'),
    }
}
The application uses SQLite as its database backend. The database file oc-lettings-site.sqlite3 is stored at the project root (BASE_DIR). No additional database server is required for development.

Templates

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
        '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',
            ],
        },
    },
]
  • DIRS points to the top-level templates/ directory at the project root, where all six application templates are stored.
  • APP_DIRS: True also allows Django to look for templates inside each installed app’s own templates/ subdirectory.

Static files

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATICFILES_DIRS = [BASE_DIR / "static"]
SettingValuePurpose
STATIC_URL/static/URL prefix for serving static files
STATIC_ROOT<BASE_DIR>/staticfiles/Destination directory when running collectstatic
STATICFILES_DIRS[<BASE_DIR>/static/]Additional directories Django searches for static files

Internationalisation

LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
The application is configured for US English with UTC timestamps and timezone-aware datetime support enabled.

Build docs developers (and LLMs) love