new be issue... cant install booktype...
  • Hi

    I am installing booktype on ubuntu 12.04.

    It seemed to install ok, but when I load the page I get a 500 error.

    Inspecting nano /var/log/apache2/booktype-error.log, I see:

    [Mon Nov 18 06:56:20 2013] [error] [client 202.160.48.73] mod_wsgi (pid=9486): Target WSGI script '/var/www/mysite.co.nz/mybooktype/mybook/booki.wsgi' cannot be loaded as Python module.
    [Mon Nov 18 06:56:20 2013] [error] [client 202.160.48.73] mod_wsgi (pid=9486): Exception occurred processing WSGI script '/var/www/mysite.co.nz/mybooktype/mybook/booki.wsgi'.
    [Mon Nov 18 06:56:20 2013] [error] [client 202.160.48.73] Traceback (most recent call last):
    [Mon Nov 18 06:56:20 2013] [error] [client 202.160.48.73]   File "/var/www/mysite.co.nz/mybooktype/mybook/booki.wsgi", line 15, in <module>
    [Mon Nov 18 06:56:20 2013] [error] [client 202.160.48.73]     import django.core.handlers.wsgi
    [Mon Nov 18 06:56:20 2013] [error] [client 202.160.48.73] ImportError: No module named django.core.handlers.wsgi

    I am sure it is something "basic", but I am a newbe in terms of linux, ubuntu and python!

    Can you please give me some pointers on

    a. how I can debug this

    b. what I can do to fix this?

    Thank you

    Nicolaas
  • 5 Comments sorted by
  • Do you have django installed?
  • make sure you install booktype in the virtual environment with django as written in the install instructions. this should solve your issue.
  • Thank you for your answers. 

    django is installed I think because I can type django-admin without an error. 

    Kararadski: I am not sure how to do this!  How do I install it in a virtual environment?  I am pretty sure that I followed the installation instructions reasonably well.

    Here are some further notes...

    Here is some information I found: 

    relevant links:

    Check out the settings in two files below:

    /var/www/mysite.co.nz/mybooktype/mybook/booki.wsgi:::


    import os, sys

    #Calculate the path based on the location of the WSGI script.
    #apache_configuration= os.path.dirname(__file__)
    #project = os.path.dirname(apache_configuration)
    #workspace = os.path.dirname(project)
    #sys.path.append(workspace)

    #Add the path to 3rd party django application and to django itself.
    sys.path.insert(0, '/var/www/mysite.co.nz/mybooktype/')
    sys.path.insert(1, '/var/www/mysite.co.nz/mybooktype/mybook/lib/')
    sys.path.insert(2, '/var/www/mysite.co.nz/mybooktype/Booktype/lib/')

    os.environ['DJANGO_SETTINGS_MODULE'] = 'mybook.settings'
    import django.core.handlers.wsgi
    application = django.core.handlers.wsgi.WSGIHandler()



    /etc/apache2/sites-enabled/booktype:::

    # Apache configuration for Booktype server V1.0.1

    <VirtualHost *:80>

         # CHANGE THIS
         ServerName mysite.co.nz
         SetEnv HTTP_HOST "mysite.co.nz"

         SetEnv LC_TIME "en_GB.UTF-8"
         SetEnv LANG "en_GB.UTF-8"

         WSGIScriptAlias / /var/www/mysite.co.nz/mybooktype/mybook/booki.wsgi

         <Location "/">
           Allow from all
           Options FollowSymLinks
         </Location>

         Alias /static/ "/var/www/mysite.co.nz/mybooktype/mybook/static/"
         <Directory "/var/www/mysite.co.nz/mybooktype/mybook/static/">
           Order allow,deny
           Options Indexes
           Allow from all
           IndexOptions FancyIndexing
         </Directory>

         Alias /site_static/ "/var/www/mysite.co.nz/mybooktype/Booktype/lib/booki/site_static/"
         <Directory "/var/www/mysite.co.nz/mybooktype/Booktype/lib/booki/site_static/">
           Order allow,deny
           Options Indexes
           Options FollowSymLinks
           Allow from all
           IndexOptions FancyIndexing
         </Directory>

         Alias /media/ "/contrib/admin/media/"
         <Directory "/contrib/admin/media">
           Order allow,deny
           Options Indexes
           Options FollowSymLinks
           Allow from all
           IndexOptions FancyIndexing
         </Directory>

         ErrorLog /var/log/apache2/booktype-error.log
         LogLevel warn
         CustomLog /var/log/apache2/booktype-access.log combined
    </VirtualHost>

    :::


    Do you know someone who I can pay to help me install it? This is for a major NGO and I would love to get it going for them. 
  • My platform is Ubuntu 12.04 and I am trying to intall the apache postgres route...
  • I helped Nicolaas but I am posting here info for other to see.

    I think he used script https://github.com/aerkalov/booktype-scrolls/blob/master/scripts/install/booktype_install.py to install Booktype. It created virtualenv and installed all needed packages but did not modify wsgi script to activate the virtualenv.

    File booki.wsgi had to activate virtualenv and everything worked after that.

    activate_this = '__PATH_TO_VIRTUALENV_/bin/activate_this.py'
    execfile(activate_this, dict(__file__=activate_this))

    Aco