Opened 19 years ago

Closed 13 years ago

Last modified 13 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: dev
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@… 19 years ago.
Better patch: ignore previous one
pep-302.diff (22.3 KB ) - added by bhuztez 13 years ago.
zip_egg_fixed.5.diff from #14087
pep-302.2.diff (41.8 KB ) - added by bhuztez 13 years ago.
add pep-302 importers support for template
pep-302.3.diff (46.4 KB ) - added by bhuztez 13 years ago.
django.db.utils.load_backend
pep-302.4.diff (51.8 KB ) - added by bhuztez 13 years ago.
translation files
pep-302.5.diff (49.0 KB ) - added by bhuztez 13 years ago.
update for revision 17868
resource-pep-302.diff (25.5 KB ) - added by bhuztez 13 years ago.
only templates and translation files

Download all attachments as: .zip

Change History (32)

comment:1 by anonymous, 19 years ago

Owner: changed from Adrian Holovaty to anonymous
Status: newassigned

comment:2 by Adrian Holovaty, 19 years ago

Owner: changed from anonymous to Adrian Holovaty
Status: assignednew

comment:3 by Adrian Holovaty, 19 years ago

Status: newassigned

by sil@…, 19 years ago

Attachment: django_as_egg_2.patch added

Better patch: ignore previous one

comment:4 by sil@…, 19 years ago

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 by Adrian Holovaty, 19 years ago

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

comment:6 by Adrian Holovaty, 19 years ago

milestone: Version 1.0

comment:7 by sil@…, 19 years ago

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 by danlipsitt@…, 19 years ago

comment:9 by Adrian Holovaty, 19 years ago

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

comment:10 by Adrian Holovaty, 19 years ago

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 by hugo, 19 years ago

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 by anonymous, 18 years ago

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

comment:13 by Adrian Holovaty, 18 years ago

priority: highestnormal
Severity: trivialnormal
Type: defectenhancement

comment:14 by Gary Wilson <gary.wilson@…>, 18 years ago

milestone: Version 0.91Version 1.0

0.91 has come and gone.

comment:15 by (none), 18 years ago

milestone: Version 1.0

Milestone Version 1.0 deleted

comment:16 by Chris Beaven, 18 years ago

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

comment:17 by James Bennett, 17 years ago

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 by anonymous, 17 years ago

could you specify what caused the maintenance headaches?

comment:19 by Jannis Leidel, 17 years ago

sorry, the question came from me :)

comment:20 by Malcolm Tredinnick, 17 years ago

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

comment:21 by bhuztez, 13 years ago

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

by bhuztez, 13 years ago

Attachment: pep-302.diff added

zip_egg_fixed.5.diff from #14087

by bhuztez, 13 years ago

Attachment: pep-302.2.diff added

add pep-302 importers support for template

by bhuztez, 13 years ago

Attachment: pep-302.3.diff added

django.db.utils.load_backend

by bhuztez, 13 years ago

Attachment: pep-302.4.diff added

translation files

by bhuztez, 13 years ago

Attachment: pep-302.5.diff added

update for revision 17868

comment:22 by bhuztez, 13 years ago

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.

by bhuztez, 13 years ago

Attachment: resource-pep-302.diff added

only templates and translation files

comment:23 by bhuztez, 13 years ago

Cc: bhuztez@… added

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

comment:24 by Jannis Leidel, 13 years ago

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.

in reply to:  24 comment:25 by bhuztez, 13 years ago

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