Opened 17 years ago

Closed 14 years ago

#7187 closed (wontfix)

Improved settings import

Reported by: Andrei <andrei@…> Owned by: nobody
Component: Core (Other) Version: dev
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: no UI/UX: no

Description

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
SetEnv DJANGO_SETTINGS_MODULE settings
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@…> 17 years ago.
modpython.patch (596 bytes ) - added by Andrei <andrei@…> 17 years ago.

Download all attachments as: .zip

Change History (12)

by Andrei <andrei@…>, 17 years ago

Attachment: apache_import.patch added

comment:1 by oyvind, 17 years ago

Resolution: invalid
Status: newclosed

Handler specific code should not go in core of django.

comment:2 by Andrei <andrei@…>, 17 years ago

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

by Andrei <andrei@…>, 17 years ago

Attachment: modpython.patch added

comment:3 by oyvind, 17 years ago

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 by Andrei <andrei@…>, 17 years ago

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 by Vali <vali.lungu@…>, 17 years ago

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

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 by Andrei <andrei@…>, 17 years ago

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 by Sung-jin Hong, 16 years ago

Needs documentation: set
Triage Stage: UnreviewedDesign decision needed

comment:10 by Łukasz Rekucki, 14 years ago

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