Code

Opened 9 years ago

Closed 2 years ago

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

Download all attachments as: .zip

Change History (32)

comment:1 Changed 9 years ago by anonymous

  • Owner changed from adrian to anonymous
  • Status changed from new to assigned

comment:2 Changed 9 years ago by adrian

  • Owner changed from anonymous to adrian
  • Status changed from assigned to new

comment:3 Changed 9 years ago by adrian

  • Status changed from new to assigned

Changed 9 years ago by sil@…

Better patch: ignore previous one

comment:4 Changed 9 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 9 years ago by adrian

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

comment:6 Changed 9 years ago by adrian

  • milestone set to Version 1.0

comment:7 Changed 9 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 9 years ago by danlipsitt@…

comment:9 Changed 9 years ago by adrian

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

comment:10 Changed 9 years ago by adrian

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 9 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 8 years ago by anonymous

  • Component changed from Core framework to Admin interface
  • milestone changed from Version 1.0 to Version 0.91
  • priority changed from normal to highest
  • Severity changed from normal to trivial
  • Type changed from enhancement to defect
  • Version set to 0.91

comment:13 Changed 8 years ago by adrian

  • priority changed from highest to normal
  • Severity changed from trivial to normal
  • Type changed from defect to enhancement

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

  • milestone changed from Version 0.91 to Version 1.0

0.91 has come and gone.

comment:15 Changed 7 years ago by anonymous

  • milestone Version 1.0 deleted

Milestone Version 1.0 deleted

comment:16 Changed 7 years ago by SmileyChris

  • Component changed from Admin interface to Core framework
  • Has patch set
  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Accepted

comment:17 Changed 7 years ago by ubernostrum

  • Resolution set to wontfix
  • Status changed from assigned to closed

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

comment:18 Changed 7 years ago by anonymous

could you specify what caused the maintenance headaches?

comment:19 Changed 7 years ago by jezdez

sorry, the question came from me :)

comment:20 Changed 7 years ago by mtredinnick

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

comment:21 Changed 2 years ago by bhuztez

  • Easy pickings unset
  • Needs documentation set
  • Resolution wontfix deleted
  • Severity changed from normal to Normal
  • Status changed from closed to reopened
  • Type changed from enhancement to Bug
  • UI/UX unset
  • Version changed from 0.91 to SVN

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 2 years ago by bhuztez

zip_egg_fixed.5.diff from #14087

Changed 2 years ago by bhuztez

add pep-302 importers support for template

Changed 2 years ago by bhuztez

django.db.utils.load_backend

Changed 2 years ago by bhuztez

translation files

Changed 2 years ago by bhuztez

update for revision 17868

comment:22 Changed 2 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 2 years ago by bhuztez

only templates and translation files

comment:23 Changed 2 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 follow-up: Changed 2 years ago by jezdez

  • Resolution set to wontfix
  • Status changed from reopened to closed

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 2 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.

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.