Opened 11 years ago

Closed 5 years ago

Last modified 5 years ago

#596 closed Bug (wontfix)

Allow Django to be packaged as a Python egg

Reported by: sil@… Owned by: nobody
Component: Core (Other) Version: master
Severity: Normal Keywords:
Cc: bhuztez@… Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

This patch allows Django to be packaged as a Python egg file. This means that you can download the Django source and build an egg file with "python setup.py bdist_egg", and that egg contains all of Django and can be dropped onto sys.path and used like other eggs. In particular, this makes it easier to use Django when you don't want to install it into your Python directory (either with "setup.py install" or with a symlink).

This patch incorporates some code from ticket #582.

Attachments (7)

django_as_egg_2.patch (8.9 KB) - added by sil@… 11 years ago.
Better patch: ignore previous one
pep-302.diff (22.3 KB) - added by bhuztez 5 years ago.
zip_egg_fixed.5.diff from #14087
pep-302.2.diff (41.8 KB) - added by bhuztez 5 years ago.
add pep-302 importers support for template
pep-302.3.diff (46.4 KB) - added by bhuztez 5 years ago.
django.db.utils.load_backend
pep-302.4.diff (51.8 KB) - added by bhuztez 5 years ago.
translation files
pep-302.5.diff (49.0 KB) - added by bhuztez 5 years ago.
update for revision 17868
resource-pep-302.diff (25.5 KB) - added by bhuztez 5 years ago.
only templates and translation files

Download all attachments as: .zip

Change History (32)

comment:1 Changed 11 years ago by anonymous

Owner: changed from Adrian Holovaty to anonymous
Status: newassigned

comment:2 Changed 11 years ago by Adrian Holovaty

Owner: changed from anonymous to Adrian Holovaty
Status: assignednew

comment:3 Changed 11 years ago by Adrian Holovaty

Status: newassigned

Changed 11 years ago by sil@…

Attachment: django_as_egg_2.patch added

Better patch: ignore previous one

comment:4 Changed 11 years ago by sil@…

Changed the patch so that it doesn't break every existing Django project. :-) Using an egg-based Django will require editing of settings/admin.py to make ADMIN_TEMPLATE_PATH be a path that includes the .egg file. Create a new project with an egg-based Django and examine settings/admin.py to see what is meant here.

This patch could do with some testing.

comment:5 Changed 11 years ago by Adrian Holovaty

Stuart (or somebody else) -- When you use Django as an egg, how do you access django-admin.py?

comment:6 Changed 11 years ago by Adrian Holovaty

milestone: Version 1.0

comment:7 Changed 11 years ago by sil@…

You have to copy django-admin.py out of the egg. I haven't come up with a good solution to this yet :( The TurboGears people have setuptools *create* their tg-admin.py, which might be an acceptable solution.

comment:8 Changed 11 years ago by danlipsitt@…

comment:9 Changed 11 years ago by Adrian Holovaty

(In [1010]) Improved autoreloader to ignore files that might be in eggs. Refs #596

comment:10 Changed 11 years ago by Adrian Holovaty

At this point, all we need to do is apply the patches to django/core/servers/basehttp.py and django/core/management.py.

comment:11 Changed 11 years ago by hugo

What still would be open (after the i18n merge) would be handling of the .po/.mo files. Currently they are expected only in the filesystem (either application, project or django-wide), not in eggs. Since I don't have an egged environment for python running, it would be better if somebody who knows eggs could look into that. The problem is that gettext.find() searches for translations and I don't think that it will take eggs into consideration (and the behaviour of gettext.find itself isn't driven by something subclasseable, at least not IIRC).

Maybe the egg patching could wait until after the i18n merge, so that we have some time to check into this and provide a patch?

comment:12 Changed 10 years ago by anonymous

Component: Core frameworkAdmin interface
milestone: Version 1.0Version 0.91
priority: normalhighest
Severity: normaltrivial
Type: enhancementdefect
Version: 0.91

comment:13 Changed 10 years ago by Adrian Holovaty

priority: highestnormal
Severity: trivialnormal
Type: defectenhancement

comment:14 Changed 10 years ago by Gary Wilson <gary.wilson@…>

milestone: Version 0.91Version 1.0

0.91 has come and gone.

comment:15 Changed 10 years ago by (none)

milestone: Version 1.0

Milestone Version 1.0 deleted

comment:16 Changed 10 years ago by Chris Beaven

Component: Admin interfaceCore framework
Has patch: set
Patch needs improvement: set
Triage Stage: UnreviewedAccepted

comment:17 Changed 9 years ago by James Bennett

Resolution: wontfix
Status: assignedclosed

Django dropped setuptools support (for Django itself) some time ago due to maintenance headaches; marking wontfix because of that.

comment:18 Changed 9 years ago by anonymous

could you specify what caused the maintenance headaches?

comment:19 Changed 9 years ago by Jannis Leidel

sorry, the question came from me :)

comment:20 Changed 9 years ago by Malcolm Tredinnick

Please ask support questions on the mailing list, rather than in Trac. Thanks.

comment:21 Changed 5 years ago by bhuztez

Easy pickings: unset
Needs documentation: set
Resolution: wontfix
Severity: normalNormal
Status: closedreopened
Type: enhancementBug
UI/UX: unset
Version: 0.91SVN

add support for PEP 302 importers should fix this.
some related tickets #294 #8238 #8280 #12206 #13334 #13587 #14087 #16718 #17331

I will move zip_egg_fixed patch here from #14087 and add PEP 302 importers support to the following components

  • templates
  • fixtures
  • static files
  • translations
  • django.db.utils.load_backend

Changed 5 years ago by bhuztez

Attachment: pep-302.diff added

zip_egg_fixed.5.diff from #14087

Changed 5 years ago by bhuztez

Attachment: pep-302.2.diff added

add pep-302 importers support for template

Changed 5 years ago by bhuztez

Attachment: pep-302.3.diff added

django.db.utils.load_backend

Changed 5 years ago by bhuztez

Attachment: pep-302.4.diff added

translation files

Changed 5 years ago by bhuztez

Attachment: pep-302.5.diff added

update for revision 17868

comment:22 Changed 5 years ago by bhuztez

I am going to separate patch into three, because they are three different problems.

  • Django will try not to import any app when finding management commands, thus we have to make assumption on (pseudo-)filesystem layout on app modules.
  • Django will import app before finding templates, fixtures, static files and locale files, and will skip some of the apps if a specific directory under app path does not exist.

django.db.utils.load_backend will be maintained under #8238. management commands from PEP-302 importers will be under #8280. Others will be remained here.

Changed 5 years ago by bhuztez

Attachment: resource-pep-302.diff added

only templates and translation files

comment:23 Changed 5 years ago by bhuztez

Cc: bhuztez@… added

the resource-pep-302 patch focus on loading resources from apps imported by PEP-302 importers

comment:24 Changed 5 years ago by Jannis Leidel

Resolution: wontfix
Status: reopenedclosed

Please don't reopen tickets that have been closed for years by core developers. Adding support for PEP 302 import hooks is only slightly related to egg files which to be honest are a no go for me too. Feel free to open a discussion about that on the developer mailing list if you haven't already.

comment:25 in reply to:  24 Changed 5 years ago by bhuztez

Replying to jezdez:

Please don't reopen tickets that have been closed for years by core developers.

I will leaved it closed.

Feel free to open a discussion about that on the developer mailing list if you haven't already.

I did. But got no response unfortunately.

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