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.

Orange County Lettings uses SQLite as its development database. The database file is stored in the project root and is managed entirely by Django’s ORM. You can also open it directly with the sqlite3 CLI to inspect tables and run ad-hoc queries.

Database configuration

The database is configured in oc_lettings_site/settings.py:
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'oc-lettings-site.sqlite3'),
    }
}
The database file is oc-lettings-site.sqlite3, located in the project root directory.

Apply migrations

Before using the database for the first time, apply Django migrations to create all required tables:
cd /path/to/Python-OC-Lettings-FR
source venv/bin/activate
python manage.py migrate
The initial migration (0001_initial.py) creates the following tables:
  • oc_lettings_site_address — postal addresses for lettings
  • oc_lettings_site_letting — rental property listings
  • oc_lettings_site_profile — user profile data including favourite city

Explore with the sqlite3 CLI

1

Open a sqlite3 shell session

sqlite3
2

Connect to the database file

.open oc-lettings-site.sqlite3
3

List all tables

.tables
4

Inspect columns in a table

View the column names and types for the profile table:
pragma table_info(oc_lettings_site_profile);
5

Query the profiles table

Retrieve user IDs and favourite cities starting with the letter B:
select user_id, favorite_city from oc_lettings_site_profile where favorite_city like 'B%';
6

Exit the shell

.quit
The SQLite database file is suitable for local development only. Do not use it in production. For production deployments, configure a production-grade database such as PostgreSQL using Django’s django.db.backends.postgresql backend.

Build docs developers (and LLMs) love