Opened 15 years ago

Closed 15 years ago

#10322 closed (duplicate)

Allow n-th level subpackage structure for django and apps

Reported by: Vadim Fint Owned by: nobody
Component: Core (Other) Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

A long time ago, I was decided want I want more elegant package structure for django apps. Take a look:

app.tools     < some tools
app.whatever
app.web       < django package
app.web.users < django app

Also I didnt want to put app.web into Python path. I want to put my app into python path and all should work.

Pretty soon I did found that this does not work :). First problem: django strangely determines project_name (dir there settings.py). Second: django translations cant find project locale dir.

I did wrote these two patches (backward compatible). All django tests pass. We are using them for ~1 year -- all looks perfect. The only drawback -- PROJECT_MODULE should be set in settings (e.g. PROJECT_MODULE = import('app.web', {}, {}, [])), because there is no way determine valid project dir in multi-level structure.

I know, you may wanna kill me after that -- but probably idea is not so bad ;). It even allows to use subapps (e.g. app.web.app.subapp), but django will ident all apps by their name, so app package still must be unique *1)

*1: Personally my dream is to allow multiple app instances -- my business web project will require this soon, so, be ready for heavy patches :).

Attachments (2)

mocksoul_true_environ.patch (1.0 KB ) - added by Vadim Fint 15 years ago.
Allow to use settings from package, e.g. app.web.settings.
mocksoul_settings_project_module.patch (1.2 KB ) - added by Vadim Fint 15 years ago.
Allow to set project module explicity in settings.

Download all attachments as: .zip

Change History (3)

by Vadim Fint, 15 years ago

Attachment: mocksoul_true_environ.patch added

Allow to use settings from package, e.g. app.web.settings.

by Vadim Fint, 15 years ago

Allow to set project module explicity in settings.

comment:1 by James Bennett, 15 years ago

Resolution: duplicate
Status: newclosed

Personally my dream is to allow multiple app instances -- my business web project will require this soon, so, be ready for heavy patches :).

Personally, my dream is for people to search the ticket tracker before opening new tickets. This is a duplicate of #3591, the goal of which (please read more than just the title of the ticket) is to provide a more flexible concept of an "application".

I suspect quite strongly that "must live on the Python path and be importable via standard Python mechanisms" will be a requirement for that, however.

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