Hello all,

With Graham's hint about possible problems caused by SELinux, I
finally figured out what was going on. Django can now serve pages!
Here is what I learned:

SELinux is installed and running by default on Fedora Core 6. This
means that along with the correct file permissions, for files to be
readable by apache they have to have the correct security context.
When you first set up Apache and serve a simple html page from '/var/
www' there is no problem because SELinux has by default already given
this path the correct security context. When you start creating
projects in Django using the 'django-admin.py startproject [project
name]' files are created that do not have the correct security
context.

Default security contexts are controlled by files in '/etc/selinux/
targeted/contexts/files'. If you grep for 'www' in this directory you
will see that '/var/www(/.*)?' has been given the correct security
context, as previously described. Interestingly, directories labeled
'www' under you home directory will also be given the correct security
context by defaule because of the following regx '/home/[^/]*/((www)|
(web)|(public_html))(/.+)? '.

Looking at the security conext of files under the /var/www directory
(using 'ls -Z'), I found that files should have the following context
inorder to be served up by Apache:
'system_u:object_r:httpd_sys_content_t'. This is compared to what my
Django files currently had: 'user_u:object_r:user_home_t'. I had to
change the type of the files, and I did so using the following
command:

chcon -R -t httpd_used_content_t myproject

My knowledge of SELinux configuration is still pretty low, and I will
continue to study it if I run into more problems. The references I
used to figure this all out are here:

http://linux.web.cern.ch/linux/scientific4/docs/rhel-selg-en-4/rhlcommon-chapter-0017.html#RHLCOMMON-SECTION-0066
http://docs.fedoraproject.org/selinux-apache-fc3/sn-simple-setup.html

On Mar 23, 2:30 am, "Graham Dumpleton" <[EMAIL PROTECTED]>
wrote:
> On Mar 23, 6:47 pm, "benrawk" <[EMAIL PROTECTED]> wrote:
>
> > Thank you again for helping. FYI, I am using Fedora Core 6. I set
> > 'PythonHandlermod_python.testhandler' in httpd.conf and got a bunch
> > of info. The sys.path appears to be correct...relevant bits, and then
> > full text beneath.
>
> > sys.path containes /home/benrawk
>
> What is the full path to the directory that Django admin project
> created. Is it:
>
>   /home/benrawk/mysite
>
> What is the output of running:
>
>   ls -las
>
> inside of that directory. Are all the files in that directory readable
> to others.
>
> > REQUEST_URI     /mysite/
> > SCRIPT_NAME     /mysite
> > PATH_INFO       /
> > PATH_TRANSLATED /var/www/html/index.html
> > ***Is this Path being translated correctly?***
>
> That is normal in this case. Because the request was against the
> directory Apache tried applying targets listed in DirectoryIndex
> directive and first one listed was probably 'index.html'.
>
> > DOCUMENT_ROOT   /var/www/html
> > SCRIPT_FILENAME /var/www/html/mysite
> > ***There is no "mysite" script under the Document root, is this being
> > interpreted correctly?***
>
> Nothing to worry about, just part of Apache's strange URL matching
> algorithm which is made somewhat more confusing by presence of
> mod_python.
>
> 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-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to