Installation Error in Ubuntu 12.04
  • I'm attempting the installation on a fairly new installation of Ubuntu 12.04. I've previously had it running perfectly on a Mint 12 system. 

    I'm following the instructions found here: https://github.com/sourcefabric/Booktype/blob/master/INSTALL

    All the steps seem to go off without a hitch right up until I get to the first django-admin.py call, and then I get the following screen dump:

    mike@Precise:/var/www/mybooktype$ django-admin.py syncdb --noinput
    Traceback (most recent call last):
      File "/usr/local/bin/django-admin.py", line 5, in <module>
        pkg_resources.run_script('Django==1.4', 'django-admin.py')
      File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 499, in run_script
        self.require(requires)[0].run_script(script_name, ns)
      File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1235, in run_script
        execfile(script_filename, namespace, namespace)
      File "/usr/local/lib/python2.7/dist-packages/Django-1.4-py2.7.egg/EGG-INFO/scripts/django-admin.py", line 5, in <module>
        management.execute_from_command_line()
      File "/usr/local/lib/python2.7/dist-packages/Django-1.4-py2.7.egg/django/core/management/__init__.py", line 443, in execute_from_command_line
        utility.execute()
      File "/usr/local/lib/python2.7/dist-packages/Django-1.4-py2.7.egg/django/core/management/__init__.py", line 382, in execute
        self.fetch_command(subcommand).run_from_argv(self.argv)
      File "/usr/local/lib/python2.7/dist-packages/Django-1.4-py2.7.egg/django/core/management/__init__.py", line 261, in fetch_command
        klass = load_command_class(app_name, subcommand)
      File "/usr/local/lib/python2.7/dist-packages/Django-1.4-py2.7.egg/django/core/management/__init__.py", line 69, in load_command_class
        module = import_module('%s.management.commands.%s' % (app_name, name))
      File "/usr/local/lib/python2.7/dist-packages/Django-1.4-py2.7.egg/django/utils/importlib.py", line 35, in import_module
        __import__(name)
      File "/usr/local/lib/python2.7/dist-packages/South-0.7.5-py2.7.egg/south/management/commands/__init__.py", line 13, in <module>
        from south.management.commands.syncdb import Command as SyncCommand
      File "/usr/local/lib/python2.7/dist-packages/South-0.7.5-py2.7.egg/south/management/commands/syncdb.py", line 17, in <module>
        from south.db import dbs
      File "/usr/local/lib/python2.7/dist-packages/South-0.7.5-py2.7.egg/south/db/__init__.py", line 78, in <module>
        db = dbs[DEFAULT_DB_ALIAS]
    KeyError: 'default'

    I've tried using postgresql, sqlite3, and mysql because it's the one I'm most familiar with. I don't seem to see any variation in the error depending on the type of DB that I'm using.

    I'm sure I'm doing something wrong that's easy and stupid here, and I just need someone to smack me upside the head and give me a clue. I'd really appreciate it.

    Thank you.
  • 4 Comments sorted by
  • Hi Mike,

    Booktype still works with older version of Django configuration and you are using latest version (Django 1.4). We plan to change it very very soon but until then you should manually change it in settings.py file.

    At the moment you have something like this:

    DATABASE_ENGINE = 'postgresql_psycopg2'

    DATABASE_NAME = 'mydatabase'

    DATABASE_USER = 'myuser'

    DATABASE_PASSWORD = 'something'

    DATABASE_HOST = 'localhost'

    DATABASE_PORT = ''

    You should change it into something like this:

    DATABASES = {
    'default': {
    'NAME': 'mydatabase',

                                             'ENGINE': 'django.db.backends.postgresql_psycopg2',

                                             'USER': 'myuser',

                                             'PASSWORD': 'something'
    }

  • Ah yes... they changed couple of things in Django 1.4. You will have to change template loaders as well. Now you have something (in settings.py file) like:

    TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.load_template_source',
          'django.template.loaders.app_directories.load_template_source',
    'django.template.loaders.eggs.load_template_source',

    and you will need to change it into something like:

    TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
    'django.template.loaders.eggs.load_template_source',
    )


  • Thank you very much! That helped a lot. I was able to get through all of the command line stuff with what looked like no errors! After everything loaded however, when I tried to access booktype, I got a new error. 

    ImproperlyConfigured at /

    Error importing template source loader django.template.loaders.filesystem.load_template_source: "'module' object has no attribute 'load_template_source'"
    Request Method:GET
    Request URL:http://127.0.0.1:8000/
    Django Version:1.4
    Exception Type:ImproperlyConfigured
    Exception Value:
    Error importing template source loader django.template.loaders.filesystem.load_template_source: "'module' object has no attribute 'load_template_source'"
    Exception Location:/usr/local/lib/python2.7/dist-packages/Django-1.4-py2.7.egg/django/template/loader.py in find_template_loader, line 101
    Python Executable:/usr/bin/python
    Python Version:2.7.3
    Python Path:
    ['/usr/local/bin',
    '/usr/local/lib/python2.7/dist-packages/Django-1.4-py2.7.egg',
    '/usr/local/lib/python2.7/dist-packages/South-0.7.5-py2.7.egg',
    '/var/www/mybooktype',
    '/var/www',
    '/var/www/mybooktype/lib',
    '/home/mike/Booktype/lib',
    '/usr/lib/python2.7',
    '/usr/lib/python2.7/plat-linux2',
    '/usr/lib/python2.7/lib-tk',
    '/usr/lib/python2.7/lib-old',
    '/usr/lib/python2.7/lib-dynload',
    '/usr/local/lib/python2.7/dist-packages',
    '/usr/lib/python2.7/dist-packages',
    '/usr/lib/python2.7/dist-packages/PIL',
    '/usr/lib/python2.7/dist-packages/gst-0.10',
    '/usr/lib/python2.7/dist-packages/gtk-2.0',
    '/usr/lib/pymodules/python2.7',
    '/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
    '/usr/lib/python2.7/dist-packages/ubuntuone-client',
    '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel',
    '/usr/lib/python2.7/dist-packages/ubuntuone-couch',
    '/usr/lib/python2.7/dist-packages/ubuntuone-installer',
    '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol',
    '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode']
    Server time:Thu, 31 May 2012 17:26:01 +0200



  • Excellent!! That worked, but with one caveat. It still gave me the error whenever I tried to load the eggs template. I commented out that entire line, and it seems to be working fine. I haven't noticed any errors or anything. I logged in, created a book, edited a chapter (Mr. Ed's Adventures: A horse is a horse of course of course), and was able to save it. Is this going to come back to bite me later on not having that template?