Code

Opened 6 years ago

Closed 5 years ago

Last modified 3 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)]

Attachments (0)

Change History (4)

comment:1 Changed 6 years ago by mtredinnick

  • milestone 1.0 deleted
  • 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 5 years ago by jacob

  • milestone set to 1.1
  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 5 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

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

Thanks, victor@….

comment:4 Changed 3 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.