Deploying Douglas with Apache and mod_wsgi

Summary

This walks through install Douglas as an WSGI application on an Apache web server with mod_wsgi installed.

If you find any issues, please let us know.

If you can help with the documentation efforts, please let us know.

Dependencies

  • Apache
  • mod_wsgi
  • administrative priveliges to the server

Deployment

  1. Make sure mod_wsgi is installed correctly and working.

  2. Create a blog—see the instructions for the blog directories, config.py setup and other bits of Setting up a blog in install_cgi.

  3. Create a douglas.wsgi script that looks something like this:

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    # This is the douglas.wsgi script that powers the _______
    # blog.
    
    import sys
    
    def add_to_path(d):
       if d not in sys.path:
          sys.path.insert(0, d)
    
    # call add_to_path with the directory that your config.py lives in.
    add_to_path("/home/joe/blog")
    
    # if you have Douglas installed in a directory and NOT as a
    # Python library, then call add_to_path with the directory that
    # Douglas lives in.  For example, if I untar'd
    # douglas-1.5.tar.gz into /home/joe/, then add like this:
    # add_to_path("/home/joe/douglas-1.5/")
    
    import Douglas.douglas
    application = Douglas.douglas.DouglasWSGIApp()
    
  4. In the Apache conf file, add:

    WSGIScriptAlias /myblog /path/to/something.wsgi
    
    <Directory /path/to>
        Order deny,allow
        Allow from all
    </Directory>
    

    Change /myblog to the url path you want your blog to live at.

    Change /path/to/something.wsgi to be the absolute path to the .wsgi file set up in step 3.

    Change /path/to to the directory of the .wsgi file.

  5. Restart the Apache web server.

Note

Any time you make changes to Douglas (update, add plugins, change configuration), you’ll have to restart Apache.