Missing basedir/apps in sys.path?
Guilherme Salgado
guilherme.salgado at linaro.org
Sat Feb 5 03:55:32 EST 2011
On Thu, 2011-02-03 at 15:34 +0100, Dirk Wallenstein wrote:
> On Thu, Feb 03, 2011 at 11:47:56AM -0200, Guilherme Salgado wrote:
> > On Thu, 2011-02-03 at 12:04 +0100, Dirk Wallenstein wrote:
> > [...]
> > > >
> > > > --- a/lib/apache2/patchwork.wsgi
> > > > +++ b/lib/apache2/patchwork.wsgi
> > > > @@ -11,6 +11,7 @@ import sys
> > > >
> > > > basedir = os.path.dirname(__file__)
> > > > sys.path.append(basedir)
> > > > +sys.path.append(os.path.join(basedir, 'apps'))
> > > >
> > > > os.environ['DJANGO_SETTINGS_MODULE'] = 'apps.settings'
> > > > import django.core.handlers.wsgi
> > >
> > > Looks good.
> > > However, I find it a bit confusing to construct a path that relies on
> > > the fact that this module is found through a symlink. I would hardcode
> > > '/srv/patchwork' and '/srv/patchwork/apps' like in the mod_python
> >
> > That means one more place people will have to remember to change when
> > deploying/moving an instance, so I don't think it's a good idea.
> >
> > > config. Or would it be possible to get rid of the symlink
> > > '/srv/patchwork/patchwork.wsgi' when changing it in
> > > apache2/patchwork.wsgi.conf and then optionally construct the paths
> > > relative from the real location?
> >
> > Yes, it's possible to use the real path to patchwork.wsgi in the apache
> > config and then have patchwork.wsgi construct the path from its real
> > location, but using the symlink may be a good idea because it provides
> > some flexibility in case there's ever a need to move patchwork.wsgi to a
> > different place. That flexibility may never be used, though.
>
> Currently, only one can be used unless os.path.realpath is added into
> the mix. I would favor to remove duplication here -- if it was broken
> anyway, that is.
Oh, sure, but I thought the idea was to use only the symlink at the
root, as that's what the example config uses. Also, you can only have
the flexibility I was talking about if you use the symlink, but then one
could also create the symlink whenever that flexibility is needed.
>
> Wonderful.
Cool, is this a +1? :)
I guess what I'm really asking is if there's anything else I should be
doing to push this through review and then have it committed?
Cheers,
--
Guilherme Salgado <https://launchpad.net/~salgado>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/patchwork/attachments/20110204/98763377/attachment.pgp>
More information about the Patchwork
mailing list