Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute:

I had problems deploying a Django project - Review Board. I did what the document says and but got "Error 403" errors when I tried visiting the site. Maybe I should have posted this question on serverfault.com, but I think this may help people write/deploy Django application in general.

Here is the installation:

I installed Review Board in /data/www/reviewboard:

.
|-- conf
|   |-- apache-modpython.conf
|   |-- search-cron.conf
|   `-- settings_local.py
|-- db
|   `-- reviewboard.db
|-- htdocs
|   |-- errordocs -> /usr/lib/python2.6/site-packages/ReviewBoard-1.0.8-py2.6.egg/reviewboard/htdocs/errordocs
|   |-- media
|   |   |-- admin -> /usr/lib/python2.6/site-packages/ReviewBoard-1.0.8-py2.6.egg/reviewboard/htdocs/media/admin
|   |   |-- djblets -> /usr/lib/python2.6/site-packages/Djblets-0.6.2-py2.6.egg/djblets/media
|   |   |-- rb -> /usr/lib/python2.6/site-packages/ReviewBoard-1.0.8-py2.6.egg/reviewboard/htdocs/media/rb
|   |   `-- uploaded
|   |       `-- images
|   `-- rb
|       |-- errordocs -> ../errordocs/
|       `-- media -> ../media/
|-- logs
`-- tmp

All files have read permission for the httpd user and the database and the uploaded directory have write permission for the httpd user.

The content of conf/apache-modpython.conf is:

  <VirtualHost *:80>
ServerName A.B.C.edu
DocumentRoot "/data/www/reviewboard/htdocs"

# Error handlers
ErrorDocument 500 /errordocs/500.html

# Serve django pages
<Location "/rb">
    PythonPath "['/data/www/reviewboard/conf'] + sys.path"
    SetEnv DJANGO_SETTINGS_MODULE reviewboard.settings
    SetEnv PYTHON_EGG_CACHE "/data/www/reviewboard/tmp/egg_cache"
    SetHandler mod_python
    PythonHandler django.core.handlers.modpython
    PythonAutoReload Off
    PythonDebug Off
    # Used to run multiple mod_python sites in the same apache
    PythonInterpreter reviewboard_reviewboard
</Location>

# Serve static media without running it through mod_python
# (overrides the above)
<Location "/media">
    SetHandler None
</Location>
<Location "/errordocs">
    SetHandler None
</Location>

<Directory "/data/www/reviewboard/htdocs">
    AllowOverride All
</Directory>

# Alias static media requests to filesystem
Alias /media /data/www/reviewboard/htdocs/media
Alias /errordocs /data/www/reviewboard/htdocs/errordocs
  </VirtualHost>

I also cited this file in the main Apache configuration file, /etc/httpd/conf/httpd.conf like this:

Include /data/www/reviewboard/conf/apache-modpython.conf

When I tried to access the site by http://A.B.C.edu/rb, I got 403 error and saw this message in httpd error log:

[Tue Jun 22 08:52:57 2010] [notice] Apache/2.2.11 (Mandriva Linux/PREFORK-10.1mdv2009.1) mod_python/3.3.1 Python/2.6.1 DAV/2 SVN/1.6.1 mod_ssl/2.2.11 OpenSSL/0.9.8k configured -- resuming normal operations
[Tue Jun 22 08:53:30 2010] [error] [client X.X.X.X] client denied by server configuration: /data/www/reviewboard/htdocs/rb

Does anybody know what I did wrong? Thanks in advance!

share|improve this question

2 Answers 2

You need to grant access to /data/www/reviewboard/htdocs

<Directory "/data/www/reviewboard/htdocs">
    Order allow,deny
    Allow from *
    AllowOverride All
</Directory>
share|improve this answer
    
Thanks for the answer. I added what you suggested, but I still got the same error in the log. It seems like the httpd tries to access "/data/www/reviewboard/htdocs/rb" directory, which does not exist. Doesn't configuration file tell httpd to run Django application instead of access the plain file system? – evergreen Jun 22 '10 at 15:50
    
oh, i see what you mean. Apache is picking up that dir instead of sending to mod_python. My answer was trying to help handle the 403. I generally use mod_wsgi, so I'm afraid the mod_python issue isn't immediately clear to me. – tommyk Jun 22 '10 at 15:59
    
Exactly. Any ideas about what I did wrong with mod_python? The configuration file was actually generated automatically by Review Board's "rb-site" script. – evergreen Jun 22 '10 at 16:03
up vote 1 down vote accepted

Found the answer from the author of Review Board. The trick is to add

Options FollowSymlinks

in the <Location> tag that points to the media directory, because that directory contains symbolic links.

More detail is in this post:

http://groups.google.com/group/reviewboard/browse_thread/thread/6fac4d0041237f15/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.