List Info

Thread: fundamental issues with configuring Apache and mod_python




fundamental issues with configuring Apache and mod_python
user name
2007-01-31 10:47:45
I am trying to experiment with django.  And, I'm at a loss. 
My
problem is that I just don't conceptually understand how to
match up
where everything is supposed to go on the filesystem and how
to
configure Apache and mod_python to be aware of it.

I am running Apache2 on Ubuntu Edgy with mod_python 3.2.8. 
And, I
have gotten my Django pages to render in a text based web
browser
(with the builtin web server).

Here's a little information about what my file system looks
like:

/usr/local/www/myDomain.com/docroot    (where my HTML went
before
Django  --  my DocumentRoot)
/usr/local/www/myDomain.com/linkshare   (where I put my
Django project
files)
/usr/local/www/myDomain.com/linkshare/polls    (where I put
the polls
app I've created from the tutorial)
/usr/local/lib/python2.4/site-packages/django    (where I
installed
Django)

So, I am confused what I should use for the paths for some
of the
directives (look for the 3 places I put
"whatGoesHere" in the snippet
from apache2.conf below):

<Location '/whatGoesHere'>
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE whatGoesHere.settings
    PythonDebug On
</Location>

<VirtualHost *:80>
    DocumentRoot /usr/local/www/myDomain.com/docroot
    ServerName www.myDomain.com
    ServerAlias myDomain.com *. myDomain.com
    PythonPath "['whatGoesHere'] + sys.path"
</VirtualHost>

Do I need a DocumentRoot directive in my VirtualHost?

My urls.py file looks like the following.  I assume it's
right because
http://localhost:8000/pol
ls works in my text browser.  Although,
http://localhost:8000/
doesn't render.  I'm not sure how to get a
default view.
urlpatterns = patterns('',
        (r'^polls/$', 'linkshare.polls.views.index'),
        (r'^polls/(?P<poll_id>d+)/$',
'linkshare.polls.views.detail'),
        (r'^polls/(?P<poll_id>d+)/results/$',
'linkshare.polls.views.results'),
        (r'^polls/(?P<poll_id>d+)/vote/$',
'linkshare.polls.views.vote'),
    # Uncomment this for admin:
        (r'^admin/', include('django.contrib.admin.urls')),


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: fundamental issues with configuring Apache and mod_python
user name
2007-01-31 11:30:10
Hi!

On Jan 31, 6:47 pm, "backdoc" <backdoc...gmail.com> wrote:
> I am trying to experiment with django.  And, I'm at a
loss.  My
> problem is that I just don't conceptually understand
how to match up
> where everything is supposed to go on the filesystem
and how to
> configure Apache and mod_python to be aware of it.

Its not clear for me where the problem is (since you see
/polls).
Just for reference here is config of my site:

<VirtualHost 195.26.95.195:80>
  ServerName alex.koval.kharkov.ua
  ServerAdmin alexkoval.kharkov.ua
  CustomLog
/var/log/apache2/alex.koval.kharkov.ua-access_log combined
  DocumentRoot
/var/www/alex.koval.kharkov.ua/PersonalWebSite/htdocs
  <Location />
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    PythonPath
"sys.path+['/var/www/alex.koval.kharkov.ua/
PersonalWebSite/','
/var/www/alex.koval.kharkov.ua/']"
    SetEnv DJANGO_SETTINGS_MODULE PersonalWebSite.settings
    SetEnv LANG en_EN
    SetEnv LC_ALL C
    PythonDebug Off
  </Location>
  <Location "/media">
    SetHandler None
  </Location>
  Alias /static
"/var/www/alex.koval.kharkov.ua/PersonalWebSite/
htdocs/"
  <Location "/static">
    SetHandler None
  </Location>
</VirtualHost>

Source code of my site can be seen here:
http://code.koval.kharkov.ua/browser/PersonalWebSite/t
runk



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: fundamental issues with configuring Apache and mod_python
user name
2007-01-31 13:09:53
Thanks ; I took your configuration and was able to configure mine accordingly.  I still don't completely understand it, but at least I can get to the admin page and the poll page. ; And, now I can finish the tutorial.&nbsp; I don't think that I have some permissions correct though because my pages don't have any style.&nbsp; So, I think I must need to open access to the Apache user to wherever the style sheets are stored.

Here's the configuration that worked for me:

<VirtualHost *:80>
&nbsp;   ; &nbsp;  ServerName www.myDomain.com
&nbsp; &nbsp; &nbsp;   ServerAlias myDomain.com *.myDomain.com
   ; &nbsp; &nbsp; DocumentRoot /usr/local/www/myDomain.com/docroot
 ; &nbsp; &nbsp; &nbsp; # # for django
&nbsp; &nbsp; &nbsp;   <Location "/&quot;>
&nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp;  SetHandler python-program
   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;  PythonHandler django.core.handlers.modpython
&nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; SetEnv DJANGO_SETTINGS_MODULE linkshare.settings
  ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; PythonDebug On
 &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   PythonPath "[9;/usr/local/www/myDomain.com/9;] + sys.path&quot;
   ; &nbsp; &nbsp; </Location>
<;/VirtualHost>

For anyone searching the archives for this topic, the keys to my problem were the following:

I moved the separate <Location> directive into my <VirtualHost> directory.  So, now the are combined.&nbsp; This next part is a complete assumption.  But, this is how it looks like to me.
The value for the <Location> directive is appended to the DocumentRoot directive to construct the path on the file system that you want Python to handle.&nbsp; So, I set mine to "/&quot;.
The "SetEnv DJANGO_SETTINGS_MODULE linkshare.settings&quot; line is either apparently relative to the path you add to the <Location> directive, which is appended to the the DocumentRoot, or it is appended to the PythonPath

Thanks Alex


On 1/31/07, alex.v.kovalgmail.com">alex.v.kovalgmail.com < alex.v.kovalgmail.com">alex.v.kovalgmail.com > wrote:

Hi!

On Jan 31, 6:47 pm, "backdoc" < backdoc...gmail.com"> backdoc...gmail.com> wrote:
>; I am trying to experiment with django.&nbsp; And, I'm at a loss. ; My
&gt; problem is that I just don't conceptually understand how to match up
> where everything is supposed to go on the filesystem and how to
> configure Apache and mod_python to be aware of it.

Its not clear for me where the problem is (since you see /polls).
Just for reference here is config of my site:

<;VirtualHost 195.26.95.195:80&gt;
 &nbsp;ServerName alex.koval.kharkov.ua
 &nbsp;ServerAdmin alexkoval.kharkov.ua">alexkoval.kharkov.ua
&nbsp; CustomLog /var/log/apache2/alex.koval.kharkov.ua-access_log combined
 &nbsp;DocumentRoot /var/www/alex.koval.kharkov.ua/PersonalWebSite/htdocs
  ;<Location />
&nbsp; &nbsp; SetHandler python-program
   ; PythonHandler django.core.handlers.modpython
&nbsp;   ;PythonPath "sys.path+['/var/www/alex.koval.kharkov.ua/
PersonalWebSite/','
/var/www/alex.koval.kharkov.ua/']"
&nbsp; &nbsp; SetEnv DJANGO_SETTINGS_MODULE PersonalWebSite.settings
 &nbsp;  SetEnv LANG en_EN
&nbsp; &nbsp; SetEnv LC_ALL C
 &nbsp; &nbsp;PythonDebug Off
  </Location>;
 &nbsp;<Location "/media">;
 &nbsp; &nbsp;SetHandler None
 ; </Location&gt;
 &nbsp;Alias /static "/var/www/alex.koval.kharkov.ua/PersonalWebSite/
htdocs/&quot;
 &nbsp;<Location "/static"&gt;
   ; SetHandler None
 ; </Location&gt;
</VirtualHost>;

Source code of my site can be seen here:
http://code.koval.kharkov.ua/browser/PersonalWebSite/trunk





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

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )