apache question

1 view
Skip to first unread message

James Carroll

unread,
Feb 10, 2009, 9:21:24 PM2/10/09
to smug-...@googlegroups.com
ok, so I have been reading django's apache configuration stuff

http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#howto-deployment-modpython

and this is what I am trying to do:

<VirtualHost smug.jlcarroll.net:80>
<Location "/>
SetHandler python-program
PythonPath "['/home/jlc/python'] + sys.path"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE django_smug.settings
</Location>
<Location "/media">
SetHandler None
DocumentRoot /home/jlc/public_html/media
</Location>
<Location "/short/path/to/media2">
SetHandler None
DocumentRoot /home/jlc/public_html/media2
</Location>
<Location "/stuff/stuff/stuff/long/path/to/media3">
SetHandler None
DocumentRoot /home/jlc/some/other/place
</Location>
</VirtualHost>

Why do I want the documentRoot command in the location tag you may
ask? simple, because django effectively has no document root, it uses
its url handler to map url's to python programs... so I need to tell
apache where to go on my filesystem for the files that django isn't
handling. I want to do it this way because I have three different
picture directories scattered all over my file system.

The problem is, I can set a document root within the virtualHost tag,
but not in the location tag. Putting it in location appears to be
illegal apache conf syntax. So how do I do this right? How do I
correctly map multiple locations to multiple documentRoots? The simple
solution would be to set up the documentRoot in the virtualHost tag,
where it is allowed, and then create the directory structure (which
isn't actually there, because urls.py is faking all that), and within
it put symlinks to where the actual media files are living, but
because I am using smug, the effective document root is actually
buried in a bare git repository. :-O So how do I make those symlinks?
I guess I could make them in the working copy, and then check them in,
but I am not entirely sure that is the correct solution. (I admit it,
I am something of a beginner at this stuff).

What is the correct solution?

James
--
"And very early in the morning
the first day of the week,
they came unto the sepulchre
at the rising of the sun..." (Mark 16:2)

Web: http://james.jlcarroll.net

Andrew McNabb

unread,
Feb 10, 2009, 10:19:09 PM2/10/09
to smug-...@googlegroups.com
On Tue, Feb 10, 2009 at 07:21:24PM -0700, James Carroll wrote:
>
> Why do I want the documentRoot command in the location tag you may
> ask? simple, because django effectively has no document root, it uses
> its url handler to map url's to python programs... so I need to tell
> apache where to go on my filesystem for the files that django isn't
> handling. I want to do it this way because I have three different
> picture directories scattered all over my file system.

I think you need to set up the DocumentRoot as if the Django stuff
weren't there at all. Then disable Django for the particular Location
that you're looking for. Does that help or am I being too general?


--
Andrew McNabb
http://www.mcnabbs.org/andrew/
PGP Fingerprint: 8A17 B57C 6879 1863 DE55 8012 AB4D 6098 8826 6868

Reply all
Reply to author
Forward
0 new messages