Discussion:
python.conf question, multiple sites on same server?
garagefan
2009-01-04 01:17:16 UTC
Permalink
I've read the documentation, and it doesn't seem clear enough, or
provide a fully working example?

i've copied what i have in my python.conf file, keep in mind that i
have removed site specific names and have made them generic


NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.website.net

<Location "/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonOption django.root /mysite
PythonDebug On
PythonPath "['/home/html'] + sys.path"
</Location>
<Location "/styles">
SetHandler None
</Location>
<Location "/images">
SetHandler None
</Location>
</VirtualHost>

i get no python errors, however when i go to the site i receive
nothing. these locations worked previous to attempting to set up a
virtual host. i assume *:80 is the port? in which case, i suppose it
may be possible that the port is incorrect? in which case, i'm unsure
as to where to check this... i assume under the apache conf file?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Graham Dumpleton
2009-01-04 01:47:04 UTC
Permalink
On Jan 4, 12:17 pm, garagefan <***@gmail.com> wrote:
> I've read the documentation, and it doesn't seem clear enough, or
> provide a fully working example?
>
> i've copied what i have in my python.conf file, keep in mind that i
> have removed site specific names and have made them generic
>
> NameVirtualHost *:80
>
> <VirtualHost *:80>
>     ServerNamewww.website.net
>
>     <Location "/">

Presumably you mean /mysite here and not the root of the web server.
This needs to match what you have set django.root to.

Graham

>         SetHandler python-program
>         PythonHandler django.core.handlers.modpython
>         SetEnv DJANGO_SETTINGS_MODULE mysite.settings
>         PythonOption django.root /mysite
>         PythonDebug On
>         PythonPath "['/home/html'] + sys.path"
>     </Location>
>     <Location "/styles">
>         SetHandler None
>     </Location>
>     <Location "/images">
>         SetHandler None
>     </Location>
> </VirtualHost>
>
> i get no python errors, however when i go to the site i receive
> nothing. these locations worked previous to attempting to set up a
> virtual host. i assume *:80 is the port? in which case, i suppose it
> may be possible that the port is incorrect? in which case, i'm unsure
> as to where to check this... i assume under the apache conf file?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Graham Dumpleton
2009-01-04 01:50:30 UTC
Permalink
BTW, with mod_python, if trying to host multiple Django sites inside
of same VirtualHost, you must set PythonInterpreter directive
differently for each.

You really need to provide a more complete example showing all the
sites and how they site with respect to each other and the VirtualHost
in the configuration.

Graham

On Jan 4, 12:47 pm, Graham Dumpleton <***@gmail.com>
wrote:
> On Jan 4, 12:17 pm, garagefan <***@gmail.com> wrote:
>
> > I've read the documentation, and it doesn't seem clear enough, or
> > provide a fully working example?
>
> > i've copied what i have in my python.conf file, keep in mind that i
> > have removed site specific names and have made them generic
>
> > NameVirtualHost *:80
>
> > <VirtualHost *:80>
> >     ServerNamewww.website.net
>
> >     <Location "/">
>
> Presumably you mean /mysite here and not the root of the web server.
> This needs to match what you have set django.root to.
>
> Graham
>
> >         SetHandler python-program
> >         PythonHandler django.core.handlers.modpython
> >         SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> >         PythonOption django.root /mysite
> >         PythonDebug On
> >         PythonPath "['/home/html'] + sys.path"
> >     </Location>
> >     <Location "/styles">
> >         SetHandler None
> >     </Location>
> >     <Location "/images">
> >         SetHandler None
> >     </Location>
> > </VirtualHost>
>
> > i get no python errors, however when i go to the site i receive
> > nothing. these locations worked previous to attempting to set up a
> > virtual host. i assume *:80 is the port? in which case, i suppose it
> > may be possible that the port is incorrect? in which case, i'm unsure
> > as to where to check this... i assume under the apache conf file?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
garagefan
2009-01-04 02:00:57 UTC
Permalink
i currently only have two sites, one is not being developed at this
time.. but w/o the virtual host that site displays the same apps and
info at it's url as the site i am working on, which i do not want to
happen. what i have copied for my virtual host is really everything i
have.

As i said, i have not been able to find much documentation on this so
i've been unable to mess around with it myself beyond this point (as
this is really only what the djangoproject site shows)

each site sits like so...

/home/(username)/

username being the base directory... so say

/home/site1/ and /home/site2/ both have a /public_html/ directory in
them which the server reads as the base level for the site. but with
the locations set up in python.conf /mysite/, which is at the same
level as public_html in the site1 directory is being used for the
apps. location '/' results in being able to target the apps via the
first slash in the url after the site name, which is the desired
result.

however now, i get the apache works page at "www.website.net" and page
not founds on anything else that worked previously to attempting to
set up the virtual host

On Jan 3, 8:50 pm, Graham Dumpleton <***@gmail.com>
wrote:
> BTW, with mod_python, if trying to host multiple Django sites inside
> of same VirtualHost, you must set PythonInterpreter directive
> differently for each.
>
> You really need to provide a more complete example showing all the
> sites and how they site with respect to each other and the VirtualHost
> in the configuration.
>
> Graham
>
> On Jan 4, 12:47 pm, Graham Dumpleton <***@gmail.com>
> wrote:
>
> > On Jan 4, 12:17 pm, garagefan <***@gmail.com> wrote:
>
> > > I've read the documentation, and it doesn't seem clear enough, or
> > > provide a fully working example?
>
> > > i've copied what i have in my python.conf file, keep in mind that i
> > > have removed site specific names and have made them generic
>
> > > NameVirtualHost *:80
>
> > > <VirtualHost *:80>
> > >     ServerNamewww.website.net
>
> > >     <Location "/">
>
> > Presumably you mean /mysite here and not the root of the web server.
> > This needs to match what you have set django.root to.
>
> > Graham
>
> > >         SetHandler python-program
> > >         PythonHandler django.core.handlers.modpython
> > >         SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> > >         PythonOption django.root /mysite
> > >         PythonDebug On
> > >         PythonPath "['/home/html'] + sys.path"
> > >     </Location>
> > >     <Location "/styles">
> > >         SetHandler None
> > >     </Location>
> > >     <Location "/images">
> > >         SetHandler None
> > >     </Location>
> > > </VirtualHost>
>
> > > i get no python errors, however when i go to the site i receive
> > > nothing. these locations worked previous to attempting to set up a
> > > virtual host. i assume *:80 is the port? in which case, i suppose it
> > > may be possible that the port is incorrect? in which case, i'm unsure
> > > as to where to check this... i assume under the apache conf file?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
garagefan
2009-01-04 01:53:41 UTC
Permalink
no, as then i would need to use, for example... www.website.net/mysite/*
instead of www.website.net/* for the various apps.

as i said the locations worked perfectly before attempting to create
the virtual host. right now i need to have this virtual host point to
the correct website on my server.

would i change server name to be an ip address? as each website on my
server has a unique address, while having the same port? since 80 is
the open port for apache

On Jan 3, 8:47 pm, Graham Dumpleton <***@gmail.com>
wrote:
> On Jan 4, 12:17 pm, garagefan <***@gmail.com> wrote:
>
> > I've read the documentation, and it doesn't seem clear enough, or
> > provide a fully working example?
>
> > i've copied what i have in my python.conf file, keep in mind that i
> > have removed site specific names and have made them generic
>
> > NameVirtualHost *:80
>
> > <VirtualHost *:80>
> >     ServerNamewww.website.net
>
> >     <Location "/">
>
> Presumably you mean /mysite here and not the root of the web server.
> This needs to match what you have set django.root to.
>
> Graham
>
> >         SetHandler python-program
> >         PythonHandler django.core.handlers.modpython
> >         SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> >         PythonOption django.root /mysite
> >         PythonDebug On
> >         PythonPath "['/home/html'] + sys.path"
> >     </Location>
> >     <Location "/styles">
> >         SetHandler None
> >     </Location>
> >     <Location "/images">
> >         SetHandler None
> >     </Location>
> > </VirtualHost>
>
> > i get no python errors, however when i go to the site i receive
> > nothing. these locations worked previous to attempting to set up a
> > virtual host. i assume *:80 is the port? in which case, i suppose it
> > may be possible that the port is incorrect? in which case, i'm unsure
> > as to where to check this... i assume under the apache conf file?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Graham Dumpleton
2009-01-04 02:22:29 UTC
Permalink
On Jan 4, 12:53 pm, garagefan <***@gmail.com> wrote:
> no, as then i would need to use, for example...www.website.net/mysite/*
> instead ofwww.website.net/*for the various apps.

If you are mounting it at root of web site, you should not be setting
django.root with PythonOption directive for a start. You only need set
django.root when mounted at a sub url. That you had set it gave the
impression you wanted it mounted at a sub url.

> as i said the locations worked perfectly before attempting to create
> the virtual host. right now i need to have this virtual host point to
> the correct website on my server.

As I said, you need to provide more complete configuration which shows
both Django sites and how you have set them up.

If your VirtualHost containers are the same except for ServerName in
each, then show that by providing the configurations for both, or be
clear about that and state it rather than us having to assume what it
all looks like.

> would i change server name to be an ip address? as each website on my
> server has a unique address, while having the same port? since 80 is
> the open port for apache

Show configurations for both VirtualHost's and then we may be able to
answer.

Graham

> On Jan 3, 8:47 pm, Graham Dumpleton <***@gmail.com>
> wrote:
>
> > On Jan 4, 12:17 pm, garagefan <***@gmail.com> wrote:
>
> > > I've read the documentation, and it doesn't seem clear enough, or
> > > provide a fully working example?
>
> > > i've copied what i have in my python.conf file, keep in mind that i
> > > have removed site specific names and have made them generic
>
> > > NameVirtualHost *:80
>
> > > <VirtualHost *:80>
> > >     ServerNamewww.website.net
>
> > >     <Location "/">
>
> > Presumably you mean /mysite here and not the root of the web server.
> > This needs to match what you have set django.root to.
>
> > Graham
>
> > >         SetHandler python-program
> > >         PythonHandler django.core.handlers.modpython
> > >         SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> > >         PythonOption django.root /mysite
> > >         PythonDebug On
> > >         PythonPath "['/home/html'] + sys.path"
> > >     </Location>
> > >     <Location "/styles">
> > >         SetHandler None
> > >     </Location>
> > >     <Location "/images">
> > >         SetHandler None
> > >     </Location>
> > > </VirtualHost>
>
> > > i get no python errors, however when i go to the site i receive
> > > nothing. these locations worked previous to attempting to set up a
> > > virtual host. i assume *:80 is the port? in which case, i suppose it
> > > may be possible that the port is incorrect? in which case, i'm unsure
> > > as to where to check this... i assume under the apache conf file?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
garagefan
2009-01-04 02:39:05 UTC
Permalink
there is currently only one virtual host set up, for the site i'm
working on. I do not need anything to happen with the other url. my
django files are in a folder at the same level as the root folder of
the site.

i simply need a virtual host for www.website.net that sits at /home/
site1/ on my server that has a django directory at /home/site1/mysite
to work. the django files themselves at /mysite work just fine, and
were working before i attempted to set up the virtual host. and
www.website.net was working just fine as well with the way the
<Location *>'s are currently set up, before the virtual host stuff was
added.

i figure i'm missing something before the first <Location> that is
causing the issue of the directory for the django apps not to be read.
I do not want to set them up in the public_html directory as that is
the main site directory, which if per chance i need to give someone
access to that... i don't want them in the django directories at all.

the server itself is a virtual server from godaddy running red hat 7
w/ apache and mod_python.

I was looking at a few pages and they mention DocumentRoot... should
this be to /home/site1 or to the project files?

how does PythonInterpreter need to be applied?

On Jan 3, 9:22 pm, Graham Dumpleton <***@gmail.com>
wrote:
> On Jan 4, 12:53 pm, garagefan <***@gmail.com> wrote:
>
> > no, as then i would need to use, for example...www.website.net/mysite/*
> > instead ofwww.website.net/*forthe various apps.
>
> If you are mounting it at root of web site, you should not be setting
> django.root with PythonOption directive for a start. You only need set
> django.root when mounted at a sub url. That you had set it gave the
> impression you wanted it mounted at a sub url.
>
> > as i said the locations worked perfectly before attempting to create
> > the virtual host. right now i need to have this virtual host point to
> > the correct website on my server.
>
> As I said, you need to provide more complete configuration which shows
> both Django sites and how you have set them up.
>
> If your VirtualHost containers are the same except for ServerName in
> each, then show that by providing the configurations for both, or be
> clear about that and state it rather than us having to assume what it
> all looks like.
>
> > would i change server name to be an ip address? as each website on my
> > server has a unique address, while having the same port? since 80 is
> > the open port for apache
>
> Show configurations for both VirtualHost's and then we may be able to
> answer.
>
> Graham
>
> > On Jan 3, 8:47 pm, Graham Dumpleton <***@gmail.com>
> > wrote:
>
> > > On Jan 4, 12:17 pm, garagefan <***@gmail.com> wrote:
>
> > > > I've read the documentation, and it doesn't seem clear enough, or
> > > > provide a fully working example?
>
> > > > i've copied what i have in my python.conf file, keep in mind that i
> > > > have removed site specific names and have made them generic
>
> > > > NameVirtualHost *:80
>
> > > > <VirtualHost *:80>
> > > >     ServerNamewww.website.net
>
> > > >     <Location "/">
>
> > > Presumably you mean /mysite here and not the root of the web server.
> > > This needs to match what you have set django.root to.
>
> > > Graham
>
> > > >         SetHandler python-program
> > > >         PythonHandler django.core.handlers.modpython
> > > >         SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> > > >         PythonOption django.root /mysite
> > > >         PythonDebug On
> > > >         PythonPath "['/home/html'] + sys.path"
> > > >     </Location>
> > > >     <Location "/styles">
> > > >         SetHandler None
> > > >     </Location>
> > > >     <Location "/images">
> > > >         SetHandler None
> > > >     </Location>
> > > > </VirtualHost>
>
> > > > i get no python errors, however when i go to the site i receive
> > > > nothing. these locations worked previous to attempting to set up a
> > > > virtual host. i assume *:80 is the port? in which case, i suppose it
> > > > may be possible that the port is incorrect? in which case, i'm unsure
> > > > as to where to check this... i assume under the apache conf file?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Graham Dumpleton
2009-01-04 03:21:31 UTC
Permalink
On Jan 4, 1:39 pm, garagefan <***@gmail.com> wrote:
> there is currently only one virtual host set up, for the site i'm
> working on. I do not need anything to happen with the other url.

But why are you mentioning 'site2' in one of the other posts and
seeing for it what you only expect for 'site1'.

> i simply need a virtual host for www.website.netthat sits at /home/
> site1/ on my server that has a django directory at /home/site1/mysite
> to work.

Your initial configuration mentions /home/html in PythonPath. It is
very frustrating when people do not post exactly the Apache
configuration they are using and then try and describe in generic
terms using fake names and paths. It is okay if it is all consistent,
but your descriptions keep changing.

> the django files themselves at  /mysite work just fine,

Can you clarify when you are talking about a URL or a directory. If a
directory, specify full path.

That you are mentioning '/mysite' here again is confusing because it
suggests a URL for a Django instance mounted at sub url of site, yet
you already seemed to have said you want to mount it at root of host,
ie., '/'.

> and
> were working before i attempted to set up the virtual host. and
> www.website.net was working just fine as well with the way the
> <Location *>'s are currently set up, before the virtual host stuff was
> added.
>
> i figure i'm missing something before the first <Location> that is
> causing the issue of the directory for the django apps not to be read.
> I do not want to set them up in the public_html directory as that is
> the main site directory, which if per chance i need to give someone
> access to that... i don't want them in the django directories at all.

It is unclear here whether you are talking about static files, eg.
images and stylesheets, or Django code. You should never stick Django
directory containing code inside of a Apache DocumentRoot directory
for a host. Your better choices are to copy the static file
directories into DocumentRoot or use a symlink to link them in from a
different location. Depending on Apache configuration you may need to
set FollowSymLinks option. Alternatively, use an Alias directive in
Apache to effectively mount them at required URL from some other
directory location. Either way, mod_python is a PITA in that you need
to have SetHandler None for the URL (Location) context where they are
when whole Django site is mounted at a parent URL to the static files.

> the server itself is a virtual server from godaddy running red hat 7
> w/ apache and mod_python.
>
> I was looking at a few pages and they mention DocumentRoot... should
> this be to /home/site1 or to the project files?

As I said above, you should never put Django code in DocumentRoot
because a mistake in Apache configuration can expose your source code
to download.

> how does PythonInterpreter need to be applied?

It doesn't if you are only hosting one Django site inside of a
VirtualHost.

Now, did you get rid of PythonOption to django.root which I said is
not needed if mounting Django at root of site. Be aware though that
that is an option only relevant to Django 1.0. Are you actually using
Django 1.0? If you are using older version of Django, then you aren't
reading the correct version of the documentation.

Problem now is that still not even clear what you actual problem is
any more. How about being very clear and give URLs for each request
you are making and state whether it works. Ie., does '/' work, does '/
images/...someimage.jpg' work, does some sub URL for part of your
application work? In other words, is the thing that doesn't work
static resources or dynamic resources? When you say you get nothing,
what do you mean by that, do you get a blank page, or simply not what
you expect?

If any don't work, is the error response a generic Apache error page
or a Django specific error page? Have you looked in the Apache error
logs to see if there are any Python error messages in there, or even
an indication that the Apache process has crashed with a segmentation
fault? Have you got DEBUG set to True for Django so that if Django is
generating the error that the error details are returned in the web
page?

Right now I can only guess at a few things. The first is django.root
as I mentioned, if you are indeed mounting Django at root of site. The
second is PythonPath doesn't also include Django instance directory in
addition to its parent. This latter will be an issue if in any part of
your code or urls.py file references stuff within the project without
explicitly referencing the site name.

To make any further guess you need to expand on the vague information
you have already provided as what constitutes don't work and what
exactly you were expecting to see.

BTW, it is presumed you properly restarted Apache between making
configuration changes.

Graham

> On Jan 3, 9:22 pm, Graham Dumpleton <***@gmail.com>
> wrote:
>
> > On Jan 4, 12:53 pm, garagefan <***@gmail.com> wrote:
>
> > > no, as then i would need to use, for example...www.website.net/mysite/*
> > > instead ofwww.website.net/*forthevarious apps.
>
> > If you are mounting it at root of web site, you should not be setting
> > django.root with PythonOption directive for a start. You only need set
> > django.root when mounted at a sub url. That you had set it gave the
> > impression you wanted it mounted at a sub url.
>
> > > as i said the locations worked perfectly before attempting to create
> > > the virtual host. right now i need to have this virtual host point to
> > > the correct website on my server.
>
> > As I said, you need to provide more complete configuration which shows
> > both Django sites and how you have set them up.
>
> > If your VirtualHost containers are the same except for ServerName in
> > each, then show that by providing the configurations for both, or be
> > clear about that and state it rather than us having to assume what it
> > all looks like.
>
> > > would i change server name to be an ip address? as each website on my
> > > server has a unique address, while having the same port? since 80 is
> > > the open port for apache
>
> > Show configurations for both VirtualHost's and then we may be able to
> > answer.
>
> > Graham
>
> > > On Jan 3, 8:47 pm, Graham Dumpleton <***@gmail.com>
> > > wrote:
>
> > > > On Jan 4, 12:17 pm, garagefan <***@gmail.com> wrote:
>
> > > > > I've read the documentation, and it doesn't seem clear enough, or
> > > > > provide a fully working example?
>
> > > > > i've copied what i have in my python.conf file, keep in mind that i
> > > > > have removed site specific names and have made them generic
>
> > > > > NameVirtualHost *:80
>
> > > > > <VirtualHost *:80>
> > > > >     ServerNamewww.website.net
>
> > > > >     <Location "/">
>
> > > > Presumably you mean /mysite here and not the root of the web server.
> > > > This needs to match what you have set django.root to.
>
> > > > Graham
>
> > > > >         SetHandler python-program
> > > > >         PythonHandler django.core.handlers.modpython
> > > > >         SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> > > > >         PythonOption django.root /mysite
> > > > >         PythonDebug On
> > > > >         PythonPath "['/home/html'] + sys.path"
> > > > >     </Location>
> > > > >     <Location "/styles">
> > > > >         SetHandler None
> > > > >     </Location>
> > > > >     <Location "/images">
> > > > >         SetHandler None
> > > > >     </Location>
> > > > > </VirtualHost>
>
> > > > > i get no python errors, however when i go to the site i receive
> > > > > nothing. these locations worked previous to attempting to set up a
> > > > > virtual host. i assume *:80 is the port? in which case, i suppose it
> > > > > may be possible that the port is incorrect? in which case, i'm unsure
> > > > > as to where to check this... i assume under the apache conf file?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
garagefan
2009-01-04 04:11:11 UTC
Permalink
this is rather aggravating as i'm unsure what exactly I need to give
you to help me :/ this isn't your fault at all, as i'm an
unexperienced with working with servers, mod_python, python and
django.

i am learning all this as I go along.

i've got two websites on my server, both with different IP addresses
(obviously)

they reside in

/home/kdwadmin
and
/home/kdwadmin2

the first directory above has another folder in it w/ my django files.
full directory is /home/kdwadmin/mysite

nevermind that my django files are placed in an inappropriate spot,

i will be taking care of that shortly, /home/django/kdwadmin will
contain the apps for the first site while there will be no directory
for the second site at this time.

my <Location>'s were set up as per the djangoprojects.com tutorial

the first directory, that includes the django apps, is for website
kennethdavid.net, the second for carclubhub.com.

so what i need to do is set up a virtual host for both sites, one that
will point kennethdavid.net/* to the django app and another that will
say carclubhub.com/* SetHandler None

there is only one port under "Listen" in the apache config file.
Should i create an ip specific listen for each website? and have :80
for one and :81 for the other and would that allow me to create two
VirtualHosts? one for each port?

On Jan 3, 10:21 pm, Graham Dumpleton <***@gmail.com>
wrote:
> On Jan 4, 1:39 pm, garagefan <***@gmail.com> wrote:
>
> > there is currently only one virtual host set up, for the site i'm
> > working on. I do not need anything to happen with the other url.
>
> But why are you mentioning 'site2' in one of the other posts and
> seeing for it what you only expect for 'site1'.
>
> > i simply need a virtual host forwww.website.netthatsits at /home/
> > site1/ on my server that has a django directory at /home/site1/mysite
> > to work.
>
> Your initial configuration mentions /home/html in PythonPath. It is
> very frustrating when people do not post exactly the Apache
> configuration they are using and then try and describe in generic
> terms using fake names and paths. It is okay if it is all consistent,
> but your descriptions keep changing.
>
> > the django files themselves at  /mysite work just fine,
>
> Can you clarify when you are talking about a URL or a directory. If a
> directory, specify full path.
>
> That you are mentioning '/mysite' here again is confusing because it
> suggests a URL for a Django instance mounted at sub url of site, yet
> you already seemed to have said you want to mount it at root of host,
> ie., '/'.
>
> > and
> > were working before i attempted to set up the virtual host. and
> >www.website.netwas working just fine as well with the way the
> > <Location *>'s are currently set up, before the virtual host stuff was
> > added.
>
> > i figure i'm missing something before the first <Location> that is
> > causing the issue of the directory for the django apps not to be read.
> > I do not want to set them up in the public_html directory as that is
> > the main site directory, which if per chance i need to give someone
> > access to that... i don't want them in the django directories at all.
>
> It is unclear here whether you are talking about static files, eg.
> images and stylesheets, or Django code. You should never stick Django
> directory containing code inside of a Apache DocumentRoot directory
> for a host. Your better choices are to copy the static file
> directories into DocumentRoot or use a symlink to link them in from a
> different location. Depending on Apache configuration you may need to
> set FollowSymLinks option. Alternatively, use an Alias directive in
> Apache to effectively mount them at required URL from some other
> directory location. Either way, mod_python is a PITA in that you need
> to have SetHandler None for the URL (Location) context where they are
> when whole Django site is mounted at a parent URL to the static files.
>
> > the server itself is a virtual server from godaddy running red hat 7
> > w/ apache and mod_python.
>
> > I was looking at a few pages and they mention DocumentRoot... should
> > this be to /home/site1 or to the project files?
>
> As I said above, you should never put Django code in DocumentRoot
> because a mistake in Apache configuration can expose your source code
> to download.
>
> > how does PythonInterpreter need to be applied?
>
> It doesn't if you are only hosting one Django site inside of a
> VirtualHost.
>
> Now, did you get rid of PythonOption to django.root which I said is
> not needed if mounting Django at root of site. Be aware though that
> that is an option only relevant to Django 1.0. Are you actually using
> Django 1.0? If you are using older version of Django, then you aren't
> reading the correct version of the documentation.
>
> Problem now is that still not even clear what you actual problem is
> any more. How about being very clear and give URLs for each request
> you are making and state whether it works. Ie., does '/' work, does '/
> images/...someimage.jpg' work, does some sub URL for part of your
> application work? In other words, is the thing that doesn't work
> static resources or dynamic resources? When you say you get nothing,
> what do you mean by that, do you get a blank page, or simply not what
> you expect?
>
> If any don't work, is the error response a generic Apache error page
> or a Django specific error page? Have you looked in the Apache error
> logs to see if there are any Python error messages in there, or even
> an indication that the Apache process has crashed with a segmentation
> fault? Have you got DEBUG set to True for Django so that if Django is
> generating the error that the error details are returned in the web
> page?
>
> Right now I can only guess at a few things. The first is django.root
> as I mentioned, if you are indeed mounting Django at root of site. The
> second is PythonPath doesn't also include Django instance directory in
> addition to its parent. This latter will be an issue if in any part of
> your code or urls.py file references stuff within the project without
> explicitly referencing the site name.
>
> To make any further guess you need to expand on the vague information
> you have already provided as what constitutes don't work and what
> exactly you were expecting to see.
>
> BTW, it is presumed you properly restarted Apache between making
> configuration changes.
>
> Graham
>
> > On Jan 3, 9:22 pm, Graham Dumpleton <***@gmail.com>
> > wrote:
>
> > > On Jan 4, 12:53 pm, garagefan <***@gmail.com> wrote:
>
> > > > no, as then i would need to use, for example...www.website.net/mysite/*
> > > > instead ofwww.website.net/*forthevariousapps.
>
> > > If you are mounting it at root of web site, you should not be setting
> > > django.root with PythonOption directive for a start. You only need set
> > > django.root when mounted at a sub url. That you had set it gave the
> > > impression you wanted it mounted at a sub url.
>
> > > > as i said the locations worked perfectly before attempting to create
> > > > the virtual host. right now i need to have this virtual host point to
> > > > the correct website on my server.
>
> > > As I said, you need to provide more complete configuration which shows
> > > both Django sites and how you have set them up.
>
> > > If your VirtualHost containers are the same except for ServerName in
> > > each, then show that by providing the configurations for both, or be
> > > clear about that and state it rather than us having to assume what it
> > > all looks like.
>
> > > > would i change server name to be an ip address? as each website on my
> > > > server has a unique address, while having the same port? since 80 is
> > > > the open port for apache
>
> > > Show configurations for both VirtualHost's and then we may be able to
> > > answer.
>
> > > Graham
>
> > > > On Jan 3, 8:47 pm, Graham Dumpleton <***@gmail.com>
> > > > wrote:
>
> > > > > On Jan 4, 12:17 pm, garagefan <***@gmail.com> wrote:
>
> > > > > > I've read the documentation, and it doesn't seem clear enough, or
> > > > > > provide a fully working example?
>
> > > > > > i've copied what i have in my python.conf file, keep in mind that i
> > > > > > have removed site specific names and have made them generic
>
> > > > > > NameVirtualHost *:80
>
> > > > > > <VirtualHost *:80>
> > > > > >     ServerNamewww.website.net
>
> > > > > >     <Location "/">
>
> > > > > Presumably you mean /mysite here and not the root of the web server.
> > > > > This needs to match what you have set django.root to.
>
> > > > > Graham
>
> > > > > >         SetHandler python-program
> > > > > >         PythonHandler django.core.handlers.modpython
> > > > > >         SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> > > > > >         PythonOption django.root /mysite
> > > > > >         PythonDebug On
> > > > > >         PythonPath "['/home/html'] + sys.path"
> > > > > >     </Location>
> > > > > >     <Location "/styles">
> > > > > >         SetHandler None
> > > > > >     </Location>
> > > > > >     <Location "/images">
> > > > > >         SetHandler None
> > > > > >     </Location>
> > > > > > </VirtualHost>
>
> > > > > > i get no python errors, however when i go to the site i receive
> > > > > > nothing. these locations worked previous to attempting to set up a
> > > > > > virtual host. i assume *:80 is the port? in which case, i suppose it
> > > > > > may be possible that the port is incorrect? in which case, i'm unsure
> > > > > > as to where to check this... i assume under the apache conf file?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Graham Dumpleton
2009-01-04 05:56:17 UTC
Permalink
On Jan 4, 3:11 pm, garagefan <***@gmail.com> wrote:
> this is rather aggravating as i'm unsure what exactly I need to give
> you to help me :/ this isn't your fault at all, as i'm an
> unexperienced with working with servers, mod_python, python and
> django.
>
> i am learning all this as I go along.
>
> i've got two websites on my server, both with different IP addresses
> (obviously)
>
> they reside in
>
> /home/kdwadmin
> and
> /home/kdwadmin2
>
> the first directory above has another folder in it w/ my django files.
> full directory is /home/kdwadmin/mysite
>
> nevermind that my django files are placed in an inappropriate spot,
>
> i will be taking care of that shortly, /home/django/kdwadmin will
> contain the apps for the first site while there will be no directory
> for the second site at this time.
>
> my <Location>'s were set up as per the djangoprojects.com tutorial
>
> the first directory, that includes the django apps, is for website
> kennethdavid.net, the second for carclubhub.com.
>
> so what i need to do is set up a virtual host for both sites, one that
> will point kennethdavid.net/* to the django app and another that will
> say carclubhub.com/* SetHandler None
>
> there is only one port under "Listen" in the apache config file.
> Should i create an ip specific listen for each website? and have :80
> for one and :81 for the other and would that allow me to create two
> VirtualHosts? one for each port?

Sorry if I have come across as a bit short with you. Feeling a bit
under pressure at the moment with a report I have to do for work. I'll
try and explain things in a bit better detail for you. Hopefully it
will help with understanding Django documentation, which in my opinion
is not too clear in some areas in relation to mod_python setup. :-)

The whole point of virtual hosts as supported by the 'Host' header in
HTTP/1.1 requests, is that it is possible to support multiple named
hosts on a single IP address/port. Thus it is sufficient to have a
single Listen directive for just port 80. As you already had, you do
also need to define the NameVirtualHost directive appropriately to
enable virtual host resolution on that port. The wildcard, ie., '*'
means that this virtual host resolution will occur no matter what IP
address was used. So the directives:

Listen 80
NameVirtualHost *:80

would be fine.

The next thing is to define a VirtualHost container for each virtual
host.

Since as explained above, the whole point of virtual hosts is support
more than one site on an IP at same port, you didn't actually need a
separate IP for each site. The only time you might really need
multiple IPs on same box for web hosting is if you wanted to use the
box to host a different site, but have it be hosted using a different
web server instance. For example, people often use nginx or lighttpd
to host static media files. If not on a different box and want
everything to appear at port 80, you need multiple IPs. Each web
server would then only listen on IP address for that server. That is
rather than '80', would listen on 'A.B.C.D:80'.

Anyway, ignoring multiple IPs and assuming only one, the VirtualHost
containers would then be:

<VirtualHost *:80>
ServerName kennethdavid.net
DocumentRoot /home/kdwadmin

...
</VirtualHost>

<VirtualHost *:80>
ServerName carclubhub.com
DocumentRoot /home/kdwadmin2

...
</VirtualHost>

That sets up the virtual hosts, but not Django itself.

For Django, since you want to mount Django at root of the virtual
host, ignoring issues of where Django code is located for now,
configuration would be:

<VirtualHost *:80>
ServerName kennethdavid.net
DocumentRoot /home/kdwadmin

<Location />
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonDebug On
PythonPath "['/home/kwadmin', '/home/kwadmin/mysite] +
sys.path"
</Location>

<Location /styles>
SetHandler None
</Location>

<Location /images>
SetHandler None
</Location>

</VirtualHost>

Note that no 'django.root' option is required for Django 1.0 if
mounted at '/'. That option is not relevant to older versions of
Django.

Note that both parent of Django directory and the Django directory are
listed to reduce chances of problems if you didn't list 'mysite' in
module references in urls.py or elsewhere.

The above assumes that the static file directories are under
DocumentRoot, thus:

/home/kwadmin/styles
/home/kwadmin/images

These should be physical copies of the directory/files and not a
symlink if Apache not configured for allowing following of symlinks
under directory associated with DocumentRoot.

The other site would be similar:

<VirtualHost *:80>
ServerName carclubhub.com
DocumentRoot /home/kdwadmin2

<Location "/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonDebug On
PythonPath "['/home/kwadmin2', '/home/kwadmin2/mysite] +
sys.path"
</Location>

<Location "/styles">
SetHandler None
</Location>

<Location "/images">
SetHandler None
</Location>

</VirtualHost>

Only other thing to add is that because Apache runs as special user,
that user must be able to search directories and read files in those
directories. This applies to static files as well as code files making
up the Django site itself.

Guess the question now is how does that compare with what you have.

Secondly, with what should be correct configuration, what do you get
if you access:

http://kennethdavid.net

and:

http://carclubhub.com

Do you get a generic Apache HTTP error page with a simple test
message? If so, what does the message say?

Alternatively, does it appear that Django is triggered? That is,
returning a working Django page, or an error page?

If the correct content is returned, but styling is wrong and images
don't show, can you access style sheets and images using:

http://kennethdavid.net/images/....

etc.

Graham

> On Jan 3, 10:21 pm, Graham Dumpleton <***@gmail.com>
> wrote:
>
> > On Jan 4, 1:39 pm, garagefan <***@gmail.com> wrote:
>
> > > there is currently only one virtual host set up, for the site i'm
> > > working on. I do not need anything to happen with the other url.
>
> > But why are you mentioning 'site2' in one of the other posts and
> > seeing for it what you only expect for 'site1'.
>
> > > i simply need a virtual host forwww.website.netthatsitsat /home/
> > > site1/ on my server that has a django directory at /home/site1/mysite
> > > to work.
>
> > Your initial configuration mentions /home/html in PythonPath. It is
> > very frustrating when people do not post exactly the Apache
> > configuration they are using and then try and describe in generic
> > terms using fake names and paths. It is okay if it is all consistent,
> > but your descriptions keep changing.
>
> > > the django files themselves at  /mysite work just fine,
>
> > Can you clarify when you are talking about a URL or a directory. If a
> > directory, specify full path.
>
> > That you are mentioning '/mysite' here again is confusing because it
> > suggests a URL for a Django instance mounted at sub url of site, yet
> > you already seemed to have said you want to mount it at root of host,
> > ie., '/'.
>
> > > and
> > > were working before i attempted to set up the virtual host. and
> > >www.website.netwasworking just fine as well with the way the
> > > <Location *>'s are currently set up, before the virtual host stuff was
> > > added.
>
> > > i figure i'm missing something before the first <Location> that is
> > > causing the issue of the directory for the django apps not to be read.
> > > I do not want to set them up in the public_html directory as that is
> > > the main site directory, which if per chance i need to give someone
> > > access to that... i don't want them in the django directories at all.
>
> > It is unclear here whether you are talking about static files, eg.
> > images and stylesheets, or Django code. You should never stick Django
> > directory containing code inside of a Apache DocumentRoot directory
> > for a host. Your better choices are to copy the static file
> > directories into DocumentRoot or use a symlink to link them in from a
> > different location. Depending on Apache configuration you may need to
> > set FollowSymLinks option. Alternatively, use an Alias directive in
> > Apache to effectively mount them at required URL from some other
> > directory location. Either way, mod_python is a PITA in that you need
> > to have SetHandler None for the URL (Location) context where they are
> > when whole Django site is mounted at a parent URL to the static files.
>
> > > the server itself is a virtual server from godaddy running red hat 7
> > > w/ apache and mod_python.
>
> > > I was looking at a few pages and they mention DocumentRoot... should
> > > this be to /home/site1 or to the project files?
>
> > As I said above, you should never put Django code in DocumentRoot
> > because a mistake in Apache configuration can expose your source code
> > to download.
>
> > > how does PythonInterpreter need to be applied?
>
> > It doesn't if you are only hosting one Django site inside of a
> > VirtualHost.
>
> > Now, did you get rid of PythonOption to django.root which I said is
> > not needed if mounting Django at root of site. Be aware though that
> > that is an option only relevant to Django 1.0. Are you actually using
> > Django 1.0? If you are using older version of Django, then you aren't
> > reading the correct version of the documentation.
>
> > Problem now is that still not even clear what you actual problem is
> > any more. How about being very clear and give URLs for each request
> > you are making and state whether it works. Ie., does '/' work, does '/
> > images/...someimage.jpg' work, does some sub URL for part of your
> > application work? In other words, is the thing that doesn't work
> > static resources or dynamic resources? When you say you get nothing,
> > what do you mean by that, do you get a blank page, or simply not what
> > you expect?
>
> > If any don't work, is the error response a generic Apache error page
> > or a Django specific error page? Have you looked in the Apache error
> > logs to see if there are any Python error messages in there, or even
> > an indication that the Apache process has crashed with a segmentation
> > fault? Have you got DEBUG set to True for Django so that if Django is
> > generating the error that the error details are returned in the web
> > page?
>
> > Right now I can only guess at a few things. The first is django.root
> > as I mentioned, if you are indeed mounting Django at root of site. The
> > second is PythonPath doesn't also include Django instance directory in
> > addition to its parent. This latter will be an issue if in any part of
> > your code or urls.py file references stuff within the project without
> > explicitly referencing the site name.
>
> > To make any further guess you need to expand on the vague information
> > you have already provided as what constitutes don't work and what
> > exactly you were expecting to see.
>
> > BTW, it is presumed you properly restarted Apache between making
> > configuration changes.
>
> > Graham
>
> > > On Jan 3, 9:22 pm, Graham Dumpleton <***@gmail.com>
> > > wrote:
>
> > > > On Jan 4, 12:53 pm, garagefan <***@gmail.com> wrote:
>
> > > > > no, as then i would need to use, for example...www.website.net/mysite/*
> > > > > instead ofwww.website.net/*forthevariousapps.
>
> > > > If you are mounting it at root of web site, you should not be setting
> > > > django.root with PythonOption directive for a start. You only need set
> > > > django.root when mounted at a sub url. That you had set it gave the
> > > > impression you wanted it mounted at a sub url.
>
> > > > > as i said the locations worked perfectly before attempting to create
> > > > > the virtual host. right now i need to have this virtual host point to
> > > > > the correct website on my server.
>
> > > > As I said, you need to provide more complete configuration which shows
> > > > both Django sites and how you have set them up.
>
> > > > If your VirtualHost containers are the same except for ServerName in
> > > > each, then show that by providing the configurations for both, or be
> > > > clear about that and state it rather than us having to assume what it
> > > > all looks like.
>
> > > > > would i change server name to be an ip address? as each website on my
> > > > > server has a unique address, while having the same port? since 80 is
> > > > > the open port for apache
>
> > > > Show configurations for both VirtualHost's and then we may be able to
> > > > answer.
>
> > > > Graham
>
> > > > > On Jan 3, 8:47 pm, Graham Dumpleton <***@gmail.com>
> > > > > wrote:
>
> > > > > > On Jan 4, 12:17 pm, garagefan <***@gmail.com> wrote:
>
> > > > > > > I've read the documentation, and it doesn't seem clear enough, or
> > > > > > > provide a fully working example?
>
> > > > > > > i've copied what i have in my python.conf file, keep in mind that i
> > > > > > > have removed site specific names and have made them generic
>
> > > > > > > NameVirtualHost *:80
>
> > > > > > > <VirtualHost *:80>
> > > > > > >     ServerNamewww.website.net
>
> > > > > > >     <Location "/">
>
> > > > > > Presumably you mean /mysite here and not the root of the web server.
> > > > > > This needs to match what you have set django.root to.
>
> > > > > > Graham
>
> > > > > > >         SetHandler python-program
> > > > > > >         PythonHandler django.core.handlers.modpython
> > > > > > >         SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> > > > > > >         PythonOption django.root /mysite
> > > > > > >         PythonDebug On
> > > > > > >         PythonPath "['/home/html'] + sys.path"
> > > > > > >     </Location>
> > > > > > >     <Location "/styles">
> > > > > > >         SetHandler None
> > > > > > >     </Location>
> > > > > > >     <Location "/images">
> > > > > > >         SetHandler None
> > > > > > >     </Location>
> > > > > > > </VirtualHost>
>
> > > > > > > i get no python errors, however when i go to the site i receive
> > > > > > > nothing. these locations worked previous to attempting to set up a
> > > > > > > virtual host. i assume *:80 is the port? in which case, i suppose it
> > > > > > > may be possible that the port is incorrect? in which case, i'm unsure
> > > > > > > as to where to check this... i assume under the apache conf file?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
garagefan
2009-01-04 21:11:08 UTC
Permalink
i do appreciate all your assistance and am growing to understand the
server side a bit more. you're right about the documentation being...
light...

i've taken what you posted and have not seen a difference at either of
the websites mentioned the main page results in the base fedora test
page saying that the server is running. the other pages result in a
page not found, ie: kennethdavid.net/blog results in this. error logs
say the same thing, file not found... except for one error, the below
being located in the error log for kennethdavid.net:

[Sun Jan 04 15:55:56 2009] [error] [client 71.230.64.77] Directory
index forbidden by Options directive: /home/kdwadmin/public_html/

is this possibly what you've mentioned in regards to apache having
permission to access? permissions for everything are either root as
owner/group and kdwadmin as owner/group. the only difference is a
directory in the images directory i had changed to be group apache so
that it had write privileges for the gallery app to upload images to.
Also worth noting is that the files in the image directory do indeed
show up in the browser

I'm not seeing any permissions based errors in the httpd error logs
either, though i could be wrong... here is the error_log from the
latest restart


[Sun Jan 04 15:55:51 2009] [notice] caught SIGTERM, shutting down
[Sun Jan 04 15:55:51 2009] [notice] suEXEC mechanism enabled
(wrapper: /usr/sbin/suexec)
[Sun Jan 04 15:55:51 2009] [warn] No JkLogFile defined in httpd.conf.
Using default /etc/httpd/logs/mod_jk.log
[Sun Jan 04 15:55:51 2009] [warn] No JkShmFile defined in httpd.conf.
Using default /etc/httpd/logs/jk-runtime-status
[Sun Jan 04 15:55:51 2009] [notice] Digest: generating secret for
digest authentication ...
[Sun Jan 04 15:55:51 2009] [notice] Digest: done
[Sun Jan 04 15:55:51 2009] [warn] No JkLogFile defined in httpd.conf.
Using default /etc/httpd/logs/mod_jk.log
[Sun Jan 04 15:55:51 2009] [warn] No JkShmFile defined in httpd.conf.
Using default /etc/httpd/logs/jk-runtime-status
[Sun Jan 04 15:55:51 2009] [notice] mod_python: Creating 4 session
mutexes based on 50 max processes and 0 max threads.
[Sun Jan 04 15:55:51 2009] [notice] mod_python: using mutex_directory /
tmp
[Sun Jan 04 15:55:51 2009] [notice] Apache/2.2.8 (Unix) DAV/2 mod_jk/
1.2.26 PHP/5.2.6 mod_python/3.3.1 Python/2.5 mod_ssl/2.2.8 OpenSSL/
0.9.8b mod_perl/2.0.3 Perl/v5.8.8 configured -- resuming normal
operations

I do currently have two separate IP addresses for the sites, could
this be causing the issue? it doesn't seem like it would

thanks again for the help, it really is appreciated.

-Ken

On Jan 4, 12:56 am, Graham Dumpleton <***@gmail.com>
wrote:
> On Jan 4, 3:11 pm, garagefan <***@gmail.com> wrote:
>
>
>
> > this is rather aggravating as i'm unsure what exactly I need to give
> > you to help me :/ this isn't your fault at all, as i'm an
> > unexperienced with working with servers, mod_python, python and
> > django.
>
> > i am learning all this as I go along.
>
> > i've got two websites on my server, both with different IP addresses
> > (obviously)
>
> > they reside in
>
> > /home/kdwadmin
> > and
> > /home/kdwadmin2
>
> > the first directory above has another folder in it w/ my django files.
> > full directory is /home/kdwadmin/mysite
>
> > nevermind that my django files are placed in an inappropriate spot,
>
> > i will be taking care of that shortly, /home/django/kdwadmin will
> > contain the apps for the first site while there will be no directory
> > for the second site at this time.
>
> > my <Location>'s were set up as per the djangoprojects.com tutorial
>
> > the first directory, that includes the django apps, is for website
> > kennethdavid.net, the second for carclubhub.com.
>
> > so what i need to do is set up a virtual host for both sites, one that
> > will point kennethdavid.net/* to the django app and another that will
> > say carclubhub.com/* SetHandler None
>
> > there is only one port under "Listen" in the apache config file.
> > Should i create an ip specific listen for each website? and have :80
> > for one and :81 for the other and would that allow me to create two
> > VirtualHosts? one for each port?
>
> Sorry if I have come across as a bit short with you. Feeling a bit
> under pressure at the moment with a report I have to do for work. I'll
> try and explain things in a bit better detail for you. Hopefully it
> will help with understanding Django documentation, which in my opinion
> is not too clear in some areas in relation to mod_python setup. :-)
>
> The whole point of virtual hosts as supported by the 'Host' header in
> HTTP/1.1 requests, is that it is possible to support multiple named
> hosts on a single IP address/port. Thus it is sufficient to have a
> single Listen directive for just port 80. As you already had, you do
> also need to define the NameVirtualHost directive appropriately to
> enable virtual host resolution on that port. The wildcard, ie., '*'
> means that this virtual host resolution will occur no matter what IP
> address was used. So the directives:
>
>   Listen 80
>   NameVirtualHost *:80
>
> would be fine.
>
> The next thing is to define a VirtualHost container for each virtual
> host.
>
> Since as explained above, the whole point of virtual hosts is support
> more than one site on an IP at same port, you didn't actually need a
> separate IP for each site. The only time you might really need
> multiple IPs on same box for web hosting is if you wanted to use the
> box to host a different site, but have it be hosted using a different
> web server instance. For example, people often use nginx or lighttpd
> to host static media files. If not on a different box and want
> everything to appear at port 80, you need multiple IPs. Each web
> server would then only listen on IP address for that server. That is
> rather than '80', would listen on 'A.B.C.D:80'.
>
> Anyway, ignoring multiple IPs and assuming only one, the VirtualHost
> containers would then be:
>
>   <VirtualHost *:80>
>   ServerName kennethdavid.net
>   DocumentRoot /home/kdwadmin
>
>   ...
>   </VirtualHost>
>
>   <VirtualHost *:80>
>   ServerName carclubhub.com
>   DocumentRoot /home/kdwadmin2
>
>   ...
>   </VirtualHost>
>
> That sets up the virtual hosts, but not Django itself.
>
> For Django, since you want to mount Django at root of the virtual
> host, ignoring issues of where Django code is located for now,
> configuration would be:
>
>   <VirtualHost *:80>
>   ServerName kennethdavid.net
>   DocumentRoot /home/kdwadmin
>
>   <Location />
>         SetHandler python-program
>         PythonHandler django.core.handlers.modpython
>         SetEnv DJANGO_SETTINGS_MODULE mysite.settings
>         PythonDebug On
>         PythonPath "['/home/kwadmin', '/home/kwadmin/mysite] +
> sys.path"
>     </Location>
>
>     <Location /styles>
>         SetHandler None
>     </Location>
>
>     <Location /images>
>         SetHandler None
>     </Location>
>
>   </VirtualHost>
>
> Note that no 'django.root' option is required for Django 1.0 if
> mounted at '/'. That option is not relevant to older versions of
> Django.
>
> Note that both parent of Django directory and the Django directory are
> listed to reduce chances of problems if you didn't list 'mysite' in
> module references in urls.py or elsewhere.
>
> The above assumes that the static file directories are under
> DocumentRoot, thus:
>
>   /home/kwadmin/styles
>   /home/kwadmin/images
>
> These should be physical copies of the directory/files and not a
> symlink if Apache not configured for allowing following of symlinks
> under directory associated with DocumentRoot.
>
> The other site would be similar:
>
>   <VirtualHost *:80>
>   ServerName carclubhub.com
>   DocumentRoot /home/kdwadmin2
>
>   <Location "/">
>         SetHandler python-program
>         PythonHandler django.core.handlers.modpython
>         SetEnv DJANGO_SETTINGS_MODULE mysite.settings
>         PythonDebug On
>         PythonPath "['/home/kwadmin2', '/home/kwadmin2/mysite] +
> sys.path"
>     </Location>
>
>     <Location "/styles">
>         SetHandler None
>     </Location>
>
>     <Location "/images">
>         SetHandler None
>     </Location>
>
>   </VirtualHost>
>
> Only other thing to add is that because Apache runs as special user,
> that user must be able to search directories and read files in those
> directories. This applies to static files as well as code files making
> up the Django site itself.
>
> Guess the question now is how does that compare with what you have.
>
> Secondly, with what should be correct configuration, what do you get
> if you access:
>
>  http://kennethdavid.net
>
> and:
>
>  http://carclubhub.com
>
> Do you get a generic Apache HTTP error page with a simple test
> message? If so, what does the message say?
>
> Alternatively, does it appear that Django is triggered? That is,
> returning a working Django page, or an error page?
>
> If the correct content is returned, but styling is wrong and images
> don't show, can you access style sheets and images using:
>
>  http://kennethdavid.net/images/....
>
> etc.
>
> Graham
>
> > On Jan 3, 10:21 pm, Graham Dumpleton <***@gmail.com>
> > wrote:
>
> > > On Jan 4, 1:39 pm, garagefan <***@gmail.com> wrote:
>
> > > > there is currently only one virtual host set up, for the site i'm
> > > > working on. I do not need anything to happen with the other url.
>
> > > But why are you mentioning 'site2' in one of the other posts and
> > > seeing for it what you only expect for 'site1'.
>
> > > > i simply need a virtual host forwww.website.netthatsitsat/home/
> > > > site1/ on my server that has a django directory at /home/site1/mysite
> > > > to work.
>
> > > Your initial configuration mentions /home/html in PythonPath. It is
> > > very frustrating when people do not post exactly the Apache
> > > configuration they are using and then try and describe in generic
> > > terms using fake names and paths. It is okay if it is all consistent,
> > > but your descriptions keep changing.
>
> > > > the django files themselves at  /mysite work just fine,
>
> > > Can you clarify when you are talking about a URL or a directory. If a
> > > directory, specify full path.
>
> > > That you are mentioning '/mysite' here again is confusing because it
> > > suggests a URL for a Django instance mounted at sub url of site, yet
> > > you already seemed to have said you want to mount it at root of host,
> > > ie., '/'.
>
> > > > and
> > > > were working before i attempted to set up the virtual host. and
> > > >www.website.netwasworkingjust fine as well with the way the
> > > > <Location *>'s are currently set up, before the virtual host stuff was
> > > > added.
>
> > > > i figure i'm missing something before the first <Location> that is
> > > > causing the issue of the directory for the django apps not to be read.
> > > > I do not want to set them up in the public_html directory as that is
> > > > the main site directory, which if per chance i need to give someone
> > > > access to that... i don't want them in the django directories at all.
>
> > > It is unclear here whether you are talking about static files, eg.
> > > images and stylesheets, or Django code. You should never stick Django
> > > directory containing code inside of a Apache DocumentRoot directory
> > > for a host. Your better choices are to copy the static file
> > > directories into DocumentRoot or use a symlink to link them in from a
> > > different location. Depending on Apache configuration you may need to
> > > set FollowSymLinks option. Alternatively, use an Alias directive in
> > > Apache to effectively mount them at required URL from some other
> > > directory location. Either way, mod_python is a PITA in that you need
> > > to have SetHandler None for the URL (Location) context where they are
> > > when whole Django site is mounted at a parent URL to the static files.
>
> > > > the server itself is a virtual server from godaddy running red hat 7
> > > > w/ apache and mod_python.
>
> > > > I was looking at a few pages and they mention DocumentRoot... should
> > > > this be to /home/site1 or to the project files?
>
> > > As I said above, you should never put Django code in DocumentRoot
> > > because a mistake in Apache configuration can expose your source code
> > > to download.
>
> > > > how does PythonInterpreter need to be applied?
>
> > > It doesn't if you are only hosting one Django site inside of a
> > > VirtualHost.
>
> > > Now, did you get rid of PythonOption to django.root which I said is
> > > not needed if mounting Django at root of site. Be aware though that
> > > that is an option only relevant to Django 1.0. Are you actually using
> > > Django 1.0? If you are using older version of Django, then you aren't
> > > reading the correct version of
>
> ...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Graham Dumpleton
2009-01-04 21:47:09 UTC
Permalink
Where exactly is the snippet file containing the Apache configuration
which you have added?

How is this being included into the main Apache configuration?

Try adding a syntax error into the snippet file, ie., add:

XXX

Then try and restart Apache. If it doesn't complain with an error in
Apache error logs, then the configuration file isn't even being read
in.

If neither site is showing anything, then all I can guess is that the
configuration isn't even being used in the first place.

Graham

garagefan wrote:
> i do appreciate all your assistance and am growing to understand the
> server side a bit more. you're right about the documentation being...
> light...
>
> i've taken what you posted and have not seen a difference at either of
> the websites mentioned the main page results in the base fedora test
> page saying that the server is running. the other pages result in a
> page not found, ie: kennethdavid.net/blog results in this. error logs
> say the same thing, file not found... except for one error, the below
> being located in the error log for kennethdavid.net:
>
> [Sun Jan 04 15:55:56 2009] [error] [client 71.230.64.77] Directory
> index forbidden by Options directive: /home/kdwadmin/public_html/
>
> is this possibly what you've mentioned in regards to apache having
> permission to access? permissions for everything are either root as
> owner/group and kdwadmin as owner/group. the only difference is a
> directory in the images directory i had changed to be group apache so
> that it had write privileges for the gallery app to upload images to.
> Also worth noting is that the files in the image directory do indeed
> show up in the browser
>
> I'm not seeing any permissions based errors in the httpd error logs
> either, though i could be wrong... here is the error_log from the
> latest restart
>
>
> [Sun Jan 04 15:55:51 2009] [notice] caught SIGTERM, shutting down
> [Sun Jan 04 15:55:51 2009] [notice] suEXEC mechanism enabled
> (wrapper: /usr/sbin/suexec)
> [Sun Jan 04 15:55:51 2009] [warn] No JkLogFile defined in httpd.conf.
> Using default /etc/httpd/logs/mod_jk.log
> [Sun Jan 04 15:55:51 2009] [warn] No JkShmFile defined in httpd.conf.
> Using default /etc/httpd/logs/jk-runtime-status
> [Sun Jan 04 15:55:51 2009] [notice] Digest: generating secret for
> digest authentication ...
> [Sun Jan 04 15:55:51 2009] [notice] Digest: done
> [Sun Jan 04 15:55:51 2009] [warn] No JkLogFile defined in httpd.conf.
> Using default /etc/httpd/logs/mod_jk.log
> [Sun Jan 04 15:55:51 2009] [warn] No JkShmFile defined in httpd.conf.
> Using default /etc/httpd/logs/jk-runtime-status
> [Sun Jan 04 15:55:51 2009] [notice] mod_python: Creating 4 session
> mutexes based on 50 max processes and 0 max threads.
> [Sun Jan 04 15:55:51 2009] [notice] mod_python: using mutex_directory /
> tmp
> [Sun Jan 04 15:55:51 2009] [notice] Apache/2.2.8 (Unix) DAV/2 mod_jk/
> 1.2.26 PHP/5.2.6 mod_python/3.3.1 Python/2.5 mod_ssl/2.2.8 OpenSSL/
> 0.9.8b mod_perl/2.0.3 Perl/v5.8.8 configured -- resuming normal
> operations
>
> I do currently have two separate IP addresses for the sites, could
> this be causing the issue? it doesn't seem like it would
>
> thanks again for the help, it really is appreciated.
>
> -Ken
>
> On Jan 4, 12:56�am, Graham Dumpleton <***@gmail.com>
> wrote:
> > On Jan 4, 3:11�pm, garagefan <***@gmail.com> wrote:
> >
> >
> >
> > > this is rather aggravating as i'm unsure what exactly I need to give
> > > you to help me :/ this isn't your fault at all, as i'm an
> > > unexperienced with working with servers, mod_python, python and
> > > django.
> >
> > > i am learning all this as I go along.
> >
> > > i've got two websites on my server, both with different IP addresses
> > > (obviously)
> >
> > > they reside in
> >
> > > /home/kdwadmin
> > > and
> > > /home/kdwadmin2
> >
> > > the first directory above has another folder in it w/ my django files.
> > > full directory is /home/kdwadmin/mysite
> >
> > > nevermind that my django files are placed in an inappropriate spot,
> >
> > > i will be taking care of that shortly, /home/django/kdwadmin will
> > > contain the apps for the first site while there will be no directory
> > > for the second site at this time.
> >
> > > my <Location>'s were set up as per the djangoprojects.com tutorial
> >
> > > the first directory, that includes the django apps, is for website
> > > kennethdavid.net, the second for carclubhub.com.
> >
> > > so what i need to do is set up a virtual host for both sites, one that
> > > will point kennethdavid.net/* to the django app and another that will
> > > say carclubhub.com/* SetHandler None
> >
> > > there is only one port under "Listen" in the apache config file.
> > > Should i create an ip specific listen for each website? and have :80
> > > for one and :81 for the other and would that allow me to create two
> > > VirtualHosts? one for each port?
> >
> > Sorry if I have come across as a bit short with you. Feeling a bit
> > under pressure at the moment with a report I have to do for work. I'll
> > try and explain things in a bit better detail for you. Hopefully it
> > will help with understanding Django documentation, which in my opinion
> > is not too clear in some areas in relation to mod_python setup. :-)
> >
> > The whole point of virtual hosts as supported by the 'Host' header in
> > HTTP/1.1 requests, is that it is possible to support multiple named
> > hosts on a single IP address/port. Thus it is sufficient to have a
> > single Listen directive for just port 80. As you already had, you do
> > also need to define the NameVirtualHost directive appropriately to
> > enable virtual host resolution on that port. The wildcard, ie., '*'
> > means that this virtual host resolution will occur no matter what IP
> > address was used. So the directives:
> >
> > � Listen 80
> > � NameVirtualHost *:80
> >
> > would be fine.
> >
> > The next thing is to define a VirtualHost container for each virtual
> > host.
> >
> > Since as explained above, the whole point of virtual hosts is support
> > more than one site on an IP at same port, you didn't actually need a
> > separate IP for each site. The only time you might really need
> > multiple IPs on same box for web hosting is if you wanted to use the
> > box to host a different site, but have it be hosted using a different
> > web server instance. For example, people often use nginx or lighttpd
> > to host static media files. If not on a different box and want
> > everything to appear at port 80, you need multiple IPs. Each web
> > server would then only listen on IP address for that server. That is
> > rather than '80', would listen on 'A.B.C.D:80'.
> >
> > Anyway, ignoring multiple IPs and assuming only one, the VirtualHost
> > containers would then be:
> >
> > � <VirtualHost *:80>
> > � ServerName kennethdavid.net
> > � DocumentRoot /home/kdwadmin
> >
> > � ...
> > � </VirtualHost>
> >
> > � <VirtualHost *:80>
> > � ServerName carclubhub.com
> > � DocumentRoot /home/kdwadmin2
> >
> > � ...
> > � </VirtualHost>
> >
> > That sets up the virtual hosts, but not Django itself.
> >
> > For Django, since you want to mount Django at root of the virtual
> > host, ignoring issues of where Django code is located for now,
> > configuration would be:
> >
> > � <VirtualHost *:80>
> > � ServerName kennethdavid.net
> > � DocumentRoot /home/kdwadmin
> >
> > � <Location />
> > � � � � SetHandler python-program
> > � � � � PythonHandler django.core.handlers.modpython
> > � � � � SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> > � � � � PythonDebug On
> > � � � � PythonPath "['/home/kwadmin', '/home/kwadmin/mysite] +
> > sys.path"
> > � � </Location>
> >
> > � � <Location /styles>
> > � � � � SetHandler None
> > � � </Location>
> >
> > � � <Location /images>
> > � � � � SetHandler None
> > � � </Location>
> >
> > � </VirtualHost>
> >
> > Note that no 'django.root' option is required for Django 1.0 if
> > mounted at '/'. That option is not relevant to older versions of
> > Django.
> >
> > Note that both parent of Django directory and the Django directory are
> > listed to reduce chances of problems if you didn't list 'mysite' in
> > module references in urls.py or elsewhere.
> >
> > The above assumes that the static file directories are under
> > DocumentRoot, thus:
> >
> > � /home/kwadmin/styles
> > � /home/kwadmin/images
> >
> > These should be physical copies of the directory/files and not a
> > symlink if Apache not configured for allowing following of symlinks
> > under directory associated with DocumentRoot.
> >
> > The other site would be similar:
> >
> > � <VirtualHost *:80>
> > � ServerName carclubhub.com
> > � DocumentRoot /home/kdwadmin2
> >
> > � <Location "/">
> > � � � � SetHandler python-program
> > � � � � PythonHandler django.core.handlers.modpython
> > � � � � SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> > � � � � PythonDebug On
> > � � � � PythonPath "['/home/kwadmin2', '/home/kwadmin2/mysite] +
> > sys.path"
> > � � </Location>
> >
> > � � <Location "/styles">
> > � � � � SetHandler None
> > � � </Location>
> >
> > � � <Location "/images">
> > � � � � SetHandler None
> > � � </Location>
> >
> > � </VirtualHost>
> >
> > Only other thing to add is that because Apache runs as special user,
> > that user must be able to search directories and read files in those
> > directories. This applies to static files as well as code files making
> > up the Django site itself.
> >
> > Guess the question now is how does that compare with what you have.
> >
> > Secondly, with what should be correct configuration, what do you get
> > if you access:
> >
> > �http://kennethdavid.net
> >
> > and:
> >
> > �http://carclubhub.com
> >
> > Do you get a generic Apache HTTP error page with a simple test
> > message? If so, what does the message say?
> >
> > Alternatively, does it appear that Django is triggered? That is,
> > returning a working Django page, or an error page?
> >
> > If the correct content is returned, but styling is wrong and images
> > don't show, can you access style sheets and images using:
> >
> > �http://kennethdavid.net/images/....
> >
> > etc.
> >
> > Graham
> >
> > > On Jan 3, 10:21�pm, Graham Dumpleton <***@gmail.com>
> > > wrote:
> >
> > > > On Jan 4, 1:39�pm, garagefan <***@gmail.com> wrote:
> >
> > > > > there is currently only one virtual host set up, for the site i'm
> > > > > working on. I do not need anything to happen with the other url.
> >
> > > > But why are you mentioning 'site2' in one of the other posts and
> > > > seeing for it what you only expect for 'site1'.
> >
> > > > > i simply need a virtual host forwww.website.netthatsitsat/home/
> > > > > site1/ on my server that has a django directory at /home/site1/mysite
> > > > > to work.
> >
> > > > Your initial configuration mentions /home/html in PythonPath. It is
> > > > very frustrating when people do not post exactly the Apache
> > > > configuration they are using and then try and describe in generic
> > > > terms using fake names and paths. It is okay if it is all consistent,
> > > > but your descriptions keep changing.
> >
> > > > > the django files themselves at �/mysite work just fine,
> >
> > > > Can you clarify when you are talking about a URL or a directory. If a
> > > > directory, specify full path.
> >
> > > > That you are mentioning '/mysite' here again is confusing because it
> > > > suggests a URL for a Django instance mounted at sub url of site, yet
> > > > you already seemed to have said you want to mount it at root of host,
> > > > ie., '/'.
> >
> > > > > and
> > > > > were working before i attempted to set up the virtual host. and
> > > > >www.website.netwasworkingjust fine as well with the way the
> > > > > <Location *>'s are currently set up, before the virtual host stuff was
> > > > > added.
> >
> > > > > i figure i'm missing something before the first <Location> that is
> > > > > causing the issue of the directory for the django apps not to be read.
> > > > > I do not want to set them up in the public_html directory as that is
> > > > > the main site directory, which if per chance i need to give someone
> > > > > access to that... i don't want them in the django directories at all.
> >
> > > > It is unclear here whether you are talking about static files, eg.
> > > > images and stylesheets, or Django code. You should never stick Django
> > > > directory containing code inside of a Apache DocumentRoot directory
> > > > for a host. Your better choices are to copy the static file
> > > > directories into DocumentRoot or use a symlink to link them in from a
> > > > different location. Depending on Apache configuration you may need to
> > > > set FollowSymLinks option. Alternatively, use an Alias directive in
> > > > Apache to effectively mount them at required URL from some other
> > > > directory location. Either way, mod_python is a PITA in that you need
> > > > to have SetHandler None for the URL (Location) context where they are
> > > > when whole Django site is mounted at a parent URL to the static files.
> >
> > > > > the server itself is a virtual server from godaddy running red hat 7
> > > > > w/ apache and mod_python.
> >
> > > > > I was looking at a few pages and they mention DocumentRoot... should
> > > > > this be to /home/site1 or to the project files?
> >
> > > > As I said above, you should never put Django code in DocumentRoot
> > > > because a mistake in Apache configuration can expose your source code
> > > > to download.
> >
> > > > > how does PythonInterpreter need to be applied?
> >
> > > > It doesn't if you are only hosting one Django site inside of a
> > > > VirtualHost.
> >
> > > > Now, did you get rid of PythonOption to django.root which I said is
> > > > not needed if mounting Django at root of site. Be aware though that
> > > > that is an option only relevant to Django 1.0. Are you actually using
> > > > Django 1.0? If you are using older version of Django, then you aren't
> > > > reading the correct version of
> >
> > ...
> >
> > read more �
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
garagefan
2009-01-04 21:54:04 UTC
Permalink
Starting httpd: Syntax error on line 1 of /etc/httpd/conf.d/
python.conf:
Invalid command 'xxx', perhaps misspelled or defined by a module not
included in the server configuration

it doesn't appear that anything in the <VirtualHost> is being read,
but there are no errors popping up related to it. i've change the *:80
to other numbers and have received errors

On Jan 4, 4:47 pm, Graham Dumpleton <***@gmail.com>
wrote:
> Where exactly is the snippet file containing the Apache configuration
> which you have added?
>
> How is this being included into the main Apache configuration?
>
> Try adding a syntax error into the snippet file, ie., add:
>
>   XXX
>
> Then try and restart Apache. If it doesn't complain with an error in
> Apache error logs, then the configuration file isn't even being read
> in.
>
> If neither site is showing anything, then all I can guess is that the
> configuration isn't even being used in the first place.
>
> Graham
>
> garagefan wrote:
> > i do appreciate all your assistance and am growing to understand the
> > server side a bit more. you're right about the documentation being...
> > light...
>
> > i've taken what you posted and have not seen a difference at either of
> > the websites mentioned the main page results in the base fedora test
> > page saying that the server is running. the other pages result in a
> > page not found, ie: kennethdavid.net/blog results in this. error logs
> > say the same thing, file not found... except for one error, the below
> > being located in the error log for kennethdavid.net:
>
> > [Sun Jan 04 15:55:56 2009] [error] [client 71.230.64.77] Directory
> > index forbidden by Options directive: /home/kdwadmin/public_html/
>
> > is this possibly what you've mentioned in regards to apache having
> > permission to access? permissions for everything are either root as
> > owner/group and kdwadmin as owner/group. the only difference is a
> > directory in the images directory i had changed to be group apache so
> > that it had write privileges for the gallery app to upload images to.
> > Also worth noting is that the files in the image directory do indeed
> > show up in the browser
>
> > I'm not seeing any permissions based errors in the httpd error logs
> > either, though i could be wrong... here is the error_log from the
> > latest restart
>
> > [Sun Jan 04 15:55:51 2009] [notice] caught SIGTERM, shutting down
> > [Sun Jan 04 15:55:51 2009] [notice] suEXEC mechanism enabled
> > (wrapper: /usr/sbin/suexec)
> > [Sun Jan 04 15:55:51 2009] [warn] No JkLogFile defined in httpd.conf.
> > Using default /etc/httpd/logs/mod_jk.log
> > [Sun Jan 04 15:55:51 2009] [warn] No JkShmFile defined in httpd.conf.
> > Using default /etc/httpd/logs/jk-runtime-status
> > [Sun Jan 04 15:55:51 2009] [notice] Digest: generating secret for
> > digest authentication ...
> > [Sun Jan 04 15:55:51 2009] [notice] Digest: done
> > [Sun Jan 04 15:55:51 2009] [warn] No JkLogFile defined in httpd.conf.
> > Using default /etc/httpd/logs/mod_jk.log
> > [Sun Jan 04 15:55:51 2009] [warn] No JkShmFile defined in httpd.conf.
> > Using default /etc/httpd/logs/jk-runtime-status
> > [Sun Jan 04 15:55:51 2009] [notice] mod_python: Creating 4 session
> > mutexes based on 50 max processes and 0 max threads.
> > [Sun Jan 04 15:55:51 2009] [notice] mod_python: using mutex_directory /
> > tmp
> > [Sun Jan 04 15:55:51 2009] [notice] Apache/2.2.8 (Unix) DAV/2 mod_jk/
> > 1.2.26 PHP/5.2.6 mod_python/3.3.1 Python/2.5 mod_ssl/2.2.8 OpenSSL/
> > 0.9.8b mod_perl/2.0.3 Perl/v5.8.8 configured -- resuming normal
> > operations
>
> > I do currently have two separate IP addresses for the sites, could
> > this be causing the issue? it doesn't seem like it would
>
> > thanks again for the help, it really is appreciated.
>
> > -Ken
>
> > On Jan 4, 12:56 am, Graham Dumpleton <***@gmail.com>
> > wrote:
> > > On Jan 4, 3:11 pm, garagefan <***@gmail.com> wrote:
>
> > > > this is rather aggravating as i'm unsure what exactly I need to give
> > > > you to help me :/ this isn't your fault at all, as i'm an
> > > > unexperienced with working with servers, mod_python, python and
> > > > django.
>
> > > > i am learning all this as I go along.
>
> > > > i've got two websites on my server, both with different IP addresses
> > > > (obviously)
>
> > > > they reside in
>
> > > > /home/kdwadmin
> > > > and
> > > > /home/kdwadmin2
>
> > > > the first directory above has another folder in it w/ my django files.
> > > > full directory is /home/kdwadmin/mysite
>
> > > > nevermind that my django files are placed in an inappropriate spot,
>
> > > > i will be taking care of that shortly, /home/django/kdwadmin will
> > > > contain the apps for the first site while there will be no directory
> > > > for the second site at this time.
>
> > > > my <Location>'s were set up as per the djangoprojects.com tutorial
>
> > > > the first directory, that includes the django apps, is for website
> > > > kennethdavid.net, the second for carclubhub.com.
>
> > > > so what i need to do is set up a virtual host for both sites, one that
> > > > will point kennethdavid.net/* to the django app and another that will
> > > > say carclubhub.com/* SetHandler None
>
> > > > there is only one port under "Listen" in the apache config file.
> > > > Should i create an ip specific listen for each website? and have :80
> > > > for one and :81 for the other and would that allow me to create two
> > > > VirtualHosts? one for each port?
>
> > > Sorry if I have come across as a bit short with you. Feeling a bit
> > > under pressure at the moment with a report I have to do for work. I'll
> > > try and explain things in a bit better detail for you. Hopefully it
> > > will help with understanding Django documentation, which in my opinion
> > > is not too clear in some areas in relation to mod_python setup. :-)
>
> > > The whole point of virtual hosts as supported by the 'Host' header in
> > > HTTP/1.1 requests, is that it is possible to support multiple named
> > > hosts on a single IP address/port. Thus it is sufficient to have a
> > > single Listen directive for just port 80. As you already had, you do
> > > also need to define the NameVirtualHost directive appropriately to
> > > enable virtual host resolution on that port. The wildcard, ie., '*'
> > > means that this virtual host resolution will occur no matter what IP
> > > address was used. So the directives:
>
> > > Listen 80
> > > NameVirtualHost *:80
>
> > > would be fine.
>
> > > The next thing is to define a VirtualHost container for each virtual
> > > host.
>
> > > Since as explained above, the whole point of virtual hosts is support
> > > more than one site on an IP at same port, you didn't actually need a
> > > separate IP for each site. The only time you might really need
> > > multiple IPs on same box for web hosting is if you wanted to use the
> > > box to host a different site, but have it be hosted using a different
> > > web server instance. For example, people often use nginx or lighttpd
> > > to host static media files. If not on a different box and want
> > > everything to appear at port 80, you need multiple IPs. Each web
> > > server would then only listen on IP address for that server. That is
> > > rather than '80', would listen on 'A.B.C.D:80'.
>
> > > Anyway, ignoring multiple IPs and assuming only one, the VirtualHost
> > > containers would then be:
>
> > > <VirtualHost *:80>
> > > ServerName kennethdavid.net
> > > DocumentRoot /home/kdwadmin
>
> > > ...
> > > </VirtualHost>
>
> > > <VirtualHost *:80>
> > > ServerName carclubhub.com
> > > DocumentRoot /home/kdwadmin2
>
> > > ...
> > > </VirtualHost>
>
> > > That sets up the virtual hosts, but not Django itself.
>
> > > For Django, since you want to mount Django at root of the virtual
> > > host, ignoring issues of where Django code is located for now,
> > > configuration would be:
>
> > > <VirtualHost *:80>
> > > ServerName kennethdavid.net
> > > DocumentRoot /home/kdwadmin
>
> > > <Location />
> > > SetHandler python-program
> > > PythonHandler django.core.handlers.modpython
> > > SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> > > PythonDebug On
> > > PythonPath "['/home/kwadmin', '/home/kwadmin/mysite] +
> > > sys.path"
> > > </Location>
>
> > > <Location /styles>
> > > SetHandler None
> > > </Location>
>
> > > <Location /images>
> > > SetHandler None
> > > </Location>
>
> > > </VirtualHost>
>
> > > Note that no 'django.root' option is required for Django 1.0 if
> > > mounted at '/'. That option is not relevant to older versions of
> > > Django.
>
> > > Note that both parent of Django directory and the Django directory are
> > > listed to reduce chances of problems if you didn't list 'mysite' in
> > > module references in urls.py or elsewhere.
>
> > > The above assumes that the static file directories are under
> > > DocumentRoot, thus:
>
> > > /home/kwadmin/styles
> > > /home/kwadmin/images
>
> > > These should be physical copies of the directory/files and not a
> > > symlink if Apache not configured for allowing following of symlinks
> > > under directory associated with DocumentRoot.
>
> > > The other site would be similar:
>
> > > <VirtualHost *:80>
> > > ServerName carclubhub.com
> > > DocumentRoot /home/kdwadmin2
>
> > > <Location "/">
> > > SetHandler python-program
> > > PythonHandler django.core.handlers.modpython
> > > SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> > > PythonDebug On
> > > PythonPath "['/home/kwadmin2', '/home/kwadmin2/mysite] +
> > > sys.path"
> > > </Location>
>
> > > <Location "/styles">
> > > SetHandler None
> > > </Location>
>
> > > <Location "/images">
> > > SetHandler None
> > > </Location>
>
> > > </VirtualHost>
>
> > > Only other thing to add is that because Apache runs as special user,
> > > that user must be able to search directories and read files in those
> > > directories. This applies to static files as well as code files making
> > > up the Django site itself.
>
> > > Guess the question now is how does that compare with what you have.
>
> ...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Graham Dumpleton
2009-01-04 22:44:52 UTC
Permalink
On Jan 5, 8:54 am, garagefan <***@gmail.com> wrote:
> Starting httpd: Syntax error on line 1 of /etc/httpd/conf.d/
> python.conf:
> Invalid command 'xxx', perhaps misspelled or defined by a module not
> included in the server configuration
>
> it doesn't appear that anything in the <VirtualHost> is being read,
> but there are no errors popping up related to it. i've change the *:80
> to other numbers and have received errors
>
> On Jan 4, 4:47 pm, Graham Dumpleton <***@gmail.com>
> wrote:
>
> > Where exactly is the snippet file containing the Apache configuration
> > which you have added?
>
> > How is this being included into the main Apache configuration?
>
> > Try adding a syntax error into the snippet file, ie., add:
>
> >   XXX
>
> > Then try and restart Apache. If it doesn't complain with an error in
> > Apache error logs, then the configuration file isn't even being read
> > in.
>
> > If neither site is showing anything, then all I can guess is that the
> > configuration isn't even being used in the first place.

The only other thing I can think of is that the order of stuff in main
Apache configuration file, as dictated by where the python.conf
snippet is included, is resulting in some residual configuration
related to configuration of '/' for server taking precedence over the
VirtualHost entries.

In all, it is just too hard to tell at this point. Is this a managed
server where you can only modify certain Apache files and then use a
web panel to restart it, or do you have full root access?

Graham
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Graham Dumpleton
2009-01-04 23:15:21 UTC
Permalink
Go through all the Apache configuration files and find all mentions of
NameVirtualHost, Listen and SetHandler directives. Post what they are
here. If SetHandler is inside of a Location/Directory container, post
what that container directive is declared as. In turn, if they are
inside of VirtualHost, post what that container directive is as well.
Show the order of all relative to each other.

In other words, triple check that there are not multiple
NameVirtualHost directives, or a SetHandler directive at global server
level which is disabling mod_python inside of VirtualHost. Duplicate
NameVirtualHost directives is only thing I can think of that could be
an issue.

BTW, do you have an images directory in the carclubhub DocumentRoot.
Ie., should it be found by the browser?

Graham

On Jan 5, 9:54 am, garagefan <***@gmail.com> wrote:
> I have root access. I've just now attempted both moving the
> NameVirtualHost *:80 around, from the python.conf to the httpd.conf,
> and changed its location in the httpd.conf.
>
> i've also moved the import for the python.conf as well, from above to
> below the NameVirtualHost and there have been no changes
> is there possibly something else that needs to be set up for the
> VirtualHost to work?
>
> On Jan 4, 5:44 pm, Graham Dumpleton <***@gmail.com>
> wrote:
>
> > On Jan 5, 8:54 am, garagefan <***@gmail.com> wrote:
>
> > > Starting httpd: Syntax error on line 1 of /etc/httpd/conf.d/
> > > python.conf:
> > > Invalid command 'xxx', perhaps misspelled or defined by a module not
> > > included in the server configuration
>
> > > it doesn't appear that anything in the <VirtualHost> is being read,
> > > but there are no errors popping up related to it. i've change the *:80
> > > to other numbers and have received errors
>
> > > On Jan 4, 4:47 pm, Graham Dumpleton <***@gmail.com>
> > > wrote:
>
> > > > Where exactly is the snippet file containing the Apache configuration
> > > > which you have added?
>
> > > > How is this being included into the main Apache configuration?
>
> > > > Try adding a syntax error into the snippet file, ie., add:
>
> > > >   XXX
>
> > > > Then try and restart Apache. If it doesn't complain with an error in
> > > > Apache error logs, then the configuration file isn't even being read
> > > > in.
>
> > > > If neither site is showing anything, then all I can guess is that the
> > > > configuration isn't even being used in the first place.
>
> > The only other thing I can think of is that the order of stuff in main
> > Apache configuration file, as dictated by where the python.conf
> > snippet is included, is resulting in some residual configuration
> > related to configuration of '/' for server taking precedence over the
> > VirtualHost entries.
>
> > In all, it is just too hard to tell at this point. Is this a managed
> > server where you can only modify certain Apache files and then use a
> > web panel to restart it, or do you have full root access?
>
> > Graham
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
garagefan
2009-01-04 23:42:36 UTC
Permalink
wish i could edit the previous post... but the styles issue was due to
the documentroot being a level below what it should have been... this
is working now using the website name as the NameVirtualHost... go
figure...

the carclubhub.com website is giving me a mod_python error, which is
expected as there is no django apps in the directory it is looking for
them in.

Graham, thanks for all your help.

On Jan 4, 6:32 pm, garagefan <***@gmail.com> wrote:
> will do, going through now... i did find this:
>
> # UseCanonicalName: Determines how Apache constructs self-referencing
> # URLs and the SERVER_NAME and SERVER_PORT variables.
> # When set "Off", Apache will use the Hostname and Port supplied
> # by the client.  When set "On", Apache will use the value of the
> # ServerName directive.
> #
> UseCanonicalName Off
>
> should i set this to On?
>
> now... i just took a look at the apache docs and then ran across
>
> http://www.issociate.de/board/goto/915418/NameVirtualHost_xxx:0_has_n...
>
> i went with the IP address and added _default_ and now it appears to
> be working, despite a warning "Starting httpd: [Sun Jan 04 18:29:52
> 2009] [warn] NameVirtualHost 72.167.92.152:80 has no VirtualHosts"
>
> django apps work, however now my style sheet does not
>
> On Jan 4, 6:15 pm, Graham Dumpleton <***@gmail.com>
> wrote:
>
> > Go through all the Apache configuration files and find all mentions of
> > NameVirtualHost, Listen and SetHandler directives. Post what they are
> > here. If SetHandler is inside of a Location/Directory container, post
> > what that container directive is declared as. In turn, if they are
> > inside of VirtualHost, post what that container directive is as well.
> > Show the order of all relative to each other.
>
> > In other words, triple check that there are not multiple
> > NameVirtualHost directives, or a SetHandler directive at global server
> > level which is disabling mod_python inside of VirtualHost. Duplicate
> > NameVirtualHost directives is only thing I can think of that could be
> > an issue.
>
> > BTW, do you have an images directory in the carclubhub DocumentRoot.
> > Ie., should it be found by the browser?
>
> > Graham
>
> > On Jan 5, 9:54 am, garagefan <***@gmail.com> wrote:
>
> > > I have root access. I've just now attempted both moving the
> > > NameVirtualHost *:80 around, from the python.conf to the httpd.conf,
> > > and changed its location in the httpd.conf.
>
> > > i've also moved the import for the python.conf as well, from above to
> > > below the NameVirtualHost and there have been no changes
> > > is there possibly something else that needs to be set up for the
> > > VirtualHost to work?
>
> > > On Jan 4, 5:44 pm, Graham Dumpleton <***@gmail.com>
> > > wrote:
>
> > > > On Jan 5, 8:54 am, garagefan <***@gmail.com> wrote:
>
> > > > > Starting httpd: Syntax error on line 1 of /etc/httpd/conf.d/
> > > > > python.conf:
> > > > > Invalid command 'xxx', perhaps misspelled or defined by a module not
> > > > > included in the server configuration
>
> > > > > it doesn't appear that anything in the <VirtualHost> is being read,
> > > > > but there are no errors popping up related to it. i've change the *:80
> > > > > to other numbers and have received errors
>
> > > > > On Jan 4, 4:47 pm, Graham Dumpleton <***@gmail.com>
> > > > > wrote:
>
> > > > > > Where exactly is the snippet file containing the Apache configuration
> > > > > > which you have added?
>
> > > > > > How is this being included into the main Apache configuration?
>
> > > > > > Try adding a syntax error into the snippet file, ie., add:
>
> > > > > >   XXX
>
> > > > > > Then try and restart Apache. If it doesn't complain with an error in
> > > > > > Apache error logs, then the configuration file isn't even being read
> > > > > > in.
>
> > > > > > If neither site is showing anything, then all I can guess is that the
> > > > > > configuration isn't even being used in the first place.
>
> > > > The only other thing I can think of is that the order of stuff in main
> > > > Apache configuration file, as dictated by where the python.conf
> > > > snippet is included, is resulting in some residual configuration
> > > > related to configuration of '/' for server taking precedence over the
> > > > VirtualHost entries.
>
> > > > In all, it is just too hard to tell at this point. Is this a managed
> > > > server where you can only modify certain Apache files and then use a
> > > > web panel to restart it, or do you have full root access?
>
> > > > Graham
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
garagefan
2009-01-04 22:54:46 UTC
Permalink
I have root access. I've just now attempted both moving the
NameVirtualHost *:80 around, from the python.conf to the httpd.conf,
and changed its location in the httpd.conf.

i've also moved the import for the python.conf as well, from above to
below the NameVirtualHost and there have been no changes
is there possibly something else that needs to be set up for the
VirtualHost to work?

On Jan 4, 5:44 pm, Graham Dumpleton <***@gmail.com>
wrote:
> On Jan 5, 8:54 am, garagefan <***@gmail.com> wrote:
>
>
>
> > Starting httpd: Syntax error on line 1 of /etc/httpd/conf.d/
> > python.conf:
> > Invalid command 'xxx', perhaps misspelled or defined by a module not
> > included in the server configuration
>
> > it doesn't appear that anything in the <VirtualHost> is being read,
> > but there are no errors popping up related to it. i've change the *:80
> > to other numbers and have received errors
>
> > On Jan 4, 4:47 pm, Graham Dumpleton <***@gmail.com>
> > wrote:
>
> > > Where exactly is the snippet file containing the Apache configuration
> > > which you have added?
>
> > > How is this being included into the main Apache configuration?
>
> > > Try adding a syntax error into the snippet file, ie., add:
>
> > >   XXX
>
> > > Then try and restart Apache. If it doesn't complain with an error in
> > > Apache error logs, then the configuration file isn't even being read
> > > in.
>
> > > If neither site is showing anything, then all I can guess is that the
> > > configuration isn't even being used in the first place.
>
> The only other thing I can think of is that the order of stuff in main
> Apache configuration file, as dictated by where the python.conf
> snippet is included, is resulting in some residual configuration
> related to configuration of '/' for server taking precedence over the
> VirtualHost entries.
>
> In all, it is just too hard to tell at this point. Is this a managed
> server where you can only modify certain Apache files and then use a
> web panel to restart it, or do you have full root access?
>
> Graham
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
garagefan
2009-01-04 23:32:08 UTC
Permalink
will do, going through now... i did find this:


# UseCanonicalName: Determines how Apache constructs self-referencing
# URLs and the SERVER_NAME and SERVER_PORT variables.
# When set "Off", Apache will use the Hostname and Port supplied
# by the client. When set "On", Apache will use the value of the
# ServerName directive.
#
UseCanonicalName Off

should i set this to On?

now... i just took a look at the apache docs and then ran across

http://www.issociate.de/board/goto/915418/NameVirtualHost_xxx:0_has_no_VirtualHosts.html

i went with the IP address and added _default_ and now it appears to
be working, despite a warning "Starting httpd: [Sun Jan 04 18:29:52
2009] [warn] NameVirtualHost 72.167.92.152:80 has no VirtualHosts"

django apps work, however now my style sheet does not

On Jan 4, 6:15 pm, Graham Dumpleton <***@gmail.com>
wrote:
> Go through all the Apache configuration files and find all mentions of
> NameVirtualHost, Listen and SetHandler directives. Post what they are
> here. If SetHandler is inside of a Location/Directory container, post
> what that container directive is declared as. In turn, if they are
> inside of VirtualHost, post what that container directive is as well.
> Show the order of all relative to each other.
>
> In other words, triple check that there are not multiple
> NameVirtualHost directives, or a SetHandler directive at global server
> level which is disabling mod_python inside of VirtualHost. Duplicate
> NameVirtualHost directives is only thing I can think of that could be
> an issue.
>
> BTW, do you have an images directory in the carclubhub DocumentRoot.
> Ie., should it be found by the browser?
>
> Graham
>
> On Jan 5, 9:54 am, garagefan <***@gmail.com> wrote:
>
> > I have root access. I've just now attempted both moving the
> > NameVirtualHost *:80 around, from the python.conf to the httpd.conf,
> > and changed its location in the httpd.conf.
>
> > i've also moved the import for the python.conf as well, from above to
> > below the NameVirtualHost and there have been no changes
> > is there possibly something else that needs to be set up for the
> > VirtualHost to work?
>
> > On Jan 4, 5:44 pm, Graham Dumpleton <***@gmail.com>
> > wrote:
>
> > > On Jan 5, 8:54 am, garagefan <***@gmail.com> wrote:
>
> > > > Starting httpd: Syntax error on line 1 of /etc/httpd/conf.d/
> > > > python.conf:
> > > > Invalid command 'xxx', perhaps misspelled or defined by a module not
> > > > included in the server configuration
>
> > > > it doesn't appear that anything in the <VirtualHost> is being read,
> > > > but there are no errors popping up related to it. i've change the *:80
> > > > to other numbers and have received errors
>
> > > > On Jan 4, 4:47 pm, Graham Dumpleton <***@gmail.com>
> > > > wrote:
>
> > > > > Where exactly is the snippet file containing the Apache configuration
> > > > > which you have added?
>
> > > > > How is this being included into the main Apache configuration?
>
> > > > > Try adding a syntax error into the snippet file, ie., add:
>
> > > > >   XXX
>
> > > > > Then try and restart Apache. If it doesn't complain with an error in
> > > > > Apache error logs, then the configuration file isn't even being read
> > > > > in.
>
> > > > > If neither site is showing anything, then all I can guess is that the
> > > > > configuration isn't even being used in the first place.
>
> > > The only other thing I can think of is that the order of stuff in main
> > > Apache configuration file, as dictated by where the python.conf
> > > snippet is included, is resulting in some residual configuration
> > > related to configuration of '/' for server taking precedence over the
> > > VirtualHost entries.
>
> > > In all, it is just too hard to tell at this point. Is this a managed
> > > server where you can only modify certain Apache files and then use a
> > > web panel to restart it, or do you have full root access?
>
> > > Graham
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com
To unsubscribe from this group, send email to django-users+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Loading...