Create the possibility to install reviewboard in a subdirectory of the webserver.

Review Request #235 — Created Feb. 10, 2008 and submitted

Information

Review Board SVN (deprecated)
trunk

Reviewers

Several requests have been seen on the forums for that review board be able to be installed on the webserver in other than the root directory. A variable 'SITE_ROOT' has been added to settings.py and where possible all absolute references to the root directory have been modified to reference this variable. Paths in the .css files have been made relative. A 'shim URLconf' (rooturl.py) has been added to absorb the subdirectory before the normal URLconfs take effect. An example apache.conf is added to the contrib directory.
Normal site walk through looking for broken links and features only - no unit testing.
PO
  1. 
      
  2. trunk/reviewboard/rooturl.py (Diff revision 1)
     
     
    Probably settings.SITE_ROOT could be referenced here as well ?
  3. 
      
chipx86
  1. 
      
  2. trunk/reviewboard/accounts/decorators.py (Diff revision 1)
     
     
     
     
    Should be more like: "%saccount/preferences/?%s=%s" % (settings.SITE_ROOT, ...)
  3. trunk/reviewboard/accounts/views.py (Diff revision 1)
     
     
    just settings.SITE_ROOT.
    
    settings.SITE_ROOT should have a "/" appended in the settings file (and we should document this). That's the convention used elsewhere in Django.
  4. Whitespace issues.
  5. Remove the / on /api
    
    This should be changed for all other uses as well. Not going to list each one individually, because that will just take too long :)
  6. trunk/reviewboard/htdocs/scripts/rb/common.js (Diff revision 1)
     
     
     
     
    You'll need to make STAR_*_IMG not have a leading /
  7. trunk/reviewboard/reviews/datagrids.py (Diff revision 1)
     
     
    Trailing whitespace.
  8. trunk/reviewboard/reviews/datagrids.py (Diff revision 1)
     
     
    No need for parens.
  9. trunk/reviewboard/rooturl.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
    I need to think through it some more, but I'm not convinced we need or want to use this file. Since URL entries are relative to their root, can't we just use Apache to tell Review Board that its root is /reviewboard/ ?
    
    The problem with hard-coding "reviewboard/" is that some installs might want something else ("reviews/" maybe). This should probably do r'^%s' % (settings.SITE_ROOT)
    
    This is especially true on setups where you don't have a prefix. I think right now, this will break all installs that use /
    1. Have tested the changes with '/' and found no problems. Like this one can use either "ROOT_URLCONF = 'reviewboard.rooturl'" or "ROOT_URLCONF = 'reviewboard.urls'" in settings with no impact now.
  10. trunk/reviewboard/rooturl.py (Diff revision 1)
     
     
     
     
    Indentation issues. Line 8 should be indented 4 spaces, and 9 not at all.
  11. trunk/reviewboard/urls.py (Diff revision 1)
     
     
    Space before and after the +
  12. 
      
PO
  1. 
      
  2. I have created this file in order to expose SITE_ROOT, in the templates especially accounts/login, reviews/star, & reviews/dashboard_entry which seemed unable to access settings.SITE_ROOT despite most other templates having no problems
  3. 
      
chipx86
  1. Thanks! Committed with a couple of changes:
    
    1) Moved the SITE_ROOT context processor and rooturl.py into djblets.util, so it's reusable in other projects.
    2) Used SITE_ROOT instead of settings.SITE_ROOT in the various pages.
    
    Committed in r1231.
    1. I'm not sure how to add comments to the review as a whole, so I'll add them here.  I added a comment to the google-code issue #424, listing a few problems I still noticed despite these changes.
      
      I would have 're-opened' the google-code issue, but didn't know how (doesn't seem possible); so I just posted an additional comment there.
      
  2.