Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#8706 closed (fixed)

Django lists *.pyo files as available database backends if you compiled Django in optimized mode

Reported by: viktor@… Owned by: nobody
Component: Database layer (models, ORM) Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

One can compile the whole Django package as optimized .pyo files or use it from a script executed by python -OO, which turns on creation of .pyo file. There is a line in db/__init__.py that lists the available backends:

available_backends = [f for f in os.listdir(backend_dir) if not f.startswith('_') and not f.startswith('.') and not f.endswith('.py') and not f.endswith('.pyc')]

It lists util.pyo and creation.pyo as available backends. The list should be filtered to include only directories instead. For example:

available_backends = [f for f in os.listdir(backend_dir) if os.path.isdir(os.path.join(backend_dir, f)]

Change History (4)

comment:1 Changed 8 years ago by Malcolm Tredinnick

milestone: 1.0
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

Not 1.0 material. That list is only used for diagnostics; this can wait.

comment:2 Changed 8 years ago by Jacob

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:3 Changed 8 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

(In [9930]) Fixed #8706 -- Improved the way we detect available database backends.

Thanks, victor@….

comment:4 Changed 5 years ago by Jacob

milestone: 1.1

Milestone 1.1 deleted

Note: See TracTickets for help on using tickets.
Back to Top