Code

Opened 5 years ago

Closed 5 years ago

#10322 closed (duplicate)

Allow n-th level subpackage structure for django and apps

Reported by: MockSoul 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: UI/UX:

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 MockSoul 5 years ago.
Allow to use settings from package, e.g. app.web.settings.
mocksoul_settings_project_module.patch (1.2 KB) - added by MockSoul 5 years ago.
Allow to set project module explicity in settings.

Download all attachments as: .zip

Change History (3)

Changed 5 years ago by MockSoul

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

Changed 5 years ago by MockSoul

Allow to set project module explicity in settings.

comment:1 Changed 5 years ago by ubernostrum

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

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.

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.