On Wed, Jul 16, 2008 at 1:49 PM, danielk <[EMAIL PROTECTED]> wrote:

>
> On Jul 16, 12:03 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> > On Wed, Jul 16, 2008 at 10:51 AM, danielk <[EMAIL PROTECTED]>
> wrote:
> >
> > > I've been doing things with PHP (and phpDocumentor) and recently
> > > started looking into Django.
> >
> > > I now have the following in my 'httpd.conf' file:
> >
> > > LoadModule python_module "C:/Progra~1/Apache~1/Apache2.2/modules/
> > > mod_python.so"
> > > <Location "/">
> > >    SetHandler python-program
> > >    PythonHandler django.core.handlers.modpython
> > >    SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> > >    PythonPath "['C:/home/python/django'] + sys.path"
> > >    PythonDebug On
> > > </Location>
> >
> > > When I restart Apache, Django works ok but the documentation generated
> > > with phpDocumentor does not rendor the page correctly. None of the
> > > colors show up and the page is just not formatted correctly, like it
> > > is not utilizing any CSS information.
> >
> > > If I uncomment those lines in 'httpd.conf' and then restart Apache
> > > then the pages rendor correctly. The pages also rendor correctly if I
> > > open them locally (ie not via http).
> >
> > > I'm sure this is a Django configuration issue, I'm just not all that
> > > familiar with Django as yet.
> >
> > > Does anyone have any idea what I need to do to get Django to display
> > > these pages correctly?
> >
> > It's not a Django configuration problem, it's an Apache configuration
> > problem.  Your Location '/' block routes the entire site to Django.
> > Presumably you have other Location blocks that are overriding this for
> > specific prefixes (like the admin media and your phpDocumentor pages),
> > because Django doesn't handle serving those pages.  It sounds like you
> need
> > another such override to handle the CSS for the phpDocumentor pages so
> that
> > they are served directly from Apache and not routed to Django at all.  To
> do
> > that you'll first need to determine what urls are being used for these
> CSS
> > files, I'm not familiar with this tool so I have no idea what they might
> be.
> >
> > Karen
>
> Thanks, that makes more sense, but I still do not understand what the
> association is between the <Location> in Apache and where my Django
> code is.
>

There isn't really any natural association between <Location> and where your
Django code lives.

<Location> blocks tell Apache how to match on and handle URLs, they have
nothing to do with file system paths.

By specifying "/" for your Django <Location> block, you are telling Apache
to route all URLs to be handled by Django.  Within that block you have also
specified (in the PythonPath) where your Django code is, but the structure
of that tree of code need not have any resemblance to the structure of the
URLs your site supports.  How Django maps a given URL to a bit of code (a
view) to run to produce the response for that URL is described here:

http://www.djangoproject.com/documentation/url_dispatch/

(Have you run through the Django tutorial on the website?  It might help
clarify things as well.)


> How do I tell Apache where my Django stuff is? If my Django stuff is
> in 'C:\home\django\mysite\' then what would the <Location> tag be? Or
> is this a mod_python configuration issue? Or should I be asking this
> on an Apache group?
>
> All I'm trying to do is to get Django working so that it does not
> interfere with any of the php stuff I already have working.
>
> I apologize if this is the wrong forum to be asking this.
>

First you need to decide what portion of your site's URLs should be handled
by Django.  Perhaps you want to partition your URLs so that anything that
starts with a certain prefix gets routed to Django, The first example here:

http://www.djangoproject.com/documentation/modpython/

shows a config that only routes URLs that start with 'mysite' to Django,
thus all other URLs would be handled just as they had been before.  (Note I
believe the prefix is present in the URLs handed to the Django code to
process, so doing this would likely require that your Django url
configuration be modified to expect this prefix.)

Alternatively you can leave the Location "/" block pointing to Django and
just add override blocks (ones that specify something more specific than
"/") that include SetHandler None (or whatever is appropriate for whatever
generates the content for the matching URLs).  Its hard to give any specific
recommendations since I don't know what the URL space for your site looks
like and have no familiarity with this php tool you are using.

Karen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to