Opened 10 years ago

Closed 7 years ago

#7187 closed (wontfix)

Improved settings import

Reported by: Andrei <andrei@…> Owned by: nobody
Component: Core (Other) Version: master
Severity: Keywords: django.conf settings import mod_python
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


I think it would be useful to try importing settings using mod_pyton.apache also. You could then have an .htaccess file like this

SetHandler python-program
PythonHandler django.core.handlers.modpython
PythonDebug On
PythonOption mod_python.importer.path "['~/']"

that will work no matter where you place the project and python will be automaticaly activated without modifying other apache configuration files. Classic method using PythonPath will also work so there is no harm adding this patch.

Attachments (2)

apache_import.patch (893 bytes) - added by Andrei <andrei@…> 10 years ago.
modpython.patch (596 bytes) - added by Andrei <andrei@…> 10 years ago.

Download all attachments as: .zip

Change History (12)

Changed 10 years ago by Andrei <andrei@…>

Attachment: apache_import.patch added

comment:1 Changed 10 years ago by oyvind

Resolution: invalid
Status: newclosed

Handler specific code should not go in core of django.

comment:2 Changed 10 years ago by Andrei <andrei@…>

Resolution: invalid
Status: closedreopened

Yes, you are right, but django.core.handlers.modpython could be patched to append the path to sys.path with the attached patch

Changed 10 years ago by Andrei <andrei@…>

Attachment: modpython.patch added

comment:3 Changed 10 years ago by oyvind

Resolution: wontfix
Status: reopenedclosed

Still not sure it is a good idea since it will make this handler work differently than the other handlers.

comment:4 Changed 10 years ago by Andrei <andrei@…>

Resolution: wontfix
Status: closedreopened

I think all handlers could be modified to auto add project directory to sys.path. If you use django internal webserver you don't need to set any path so they are already working differently. Unless there are other problems I don't see why this feature shouldn't be added.

comment:5 Changed 10 years ago by Vali <vali.lungu@…>

I guess Andrei came up with a good idea. In my opinion, there are lots of people using Django + mod_python and quite some are beginners like myself. Having a whole bunch of things to configure before creating a truly versatile, modular Apache+mod_python+Django project ready to be deployed is very cumbersome, especially for someone without years and years of experience.

So, I think that the less you have to configure when setting up your Django projects - the more Django will become appreciated and used by a wider range of developers.

comment:6 Changed 10 years ago by anonymous

I think this must be taken to django-developers, not for me to decide.

But it has to be done for all handlers then.

I personally would not prefer my handler messing with pythonpath.

comment:7 Changed 10 years ago by Andrei <andrei@…>

Sure thing django developers should decide this, but the thing is I can't think of a situation in which I wouldn't need to change the pythonpath and my project still would work. You need to have the applications in the path in order for import to work and why shouldn't that be done automatically?

Any django developer reading this ? :D

comment:9 Changed 9 years ago by Sung-jin Hong

Needs documentation: set
Triage Stage: UnreviewedDesign decision needed

comment:10 Changed 7 years ago by Łukasz Rekucki

Keywords: mod_python added
Resolution: wontfix
Status: reopenedclosed

mod_python is deprecated, so closing this permanently as won't fix.

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