Error installing Book Type when it comes to syncdb
  • I'm following the instructions here.

    All does well, database installed, code downloaded from git, settings
    altered, until the command. No errors till section 7 of the stage the
    command. syncdb --noinput

    This triggers the error below. I'm aware this error is specific to
    the applications but I would welcome advice of what might be causing the
    problem. And things I can try to do to solve it.
    I've recreated this problem on the Debian squeeze server I use and my
    Ubuntu 12.04 desktop too. Let me know if more info would be helpful.

    Traceback (most recent call last):
    File "/usr/local/bin/", line 5, in
    pkg_resources.run_script('Django==1.5', '')
    File "/usr/lib/python2.7/dist-packages/", line 499, in run_script
    self.require(requires)[0].run_script(script_name, ns)
    File "/usr/lib/python2.7/dist-packages/", line 1235, in run_script
    execfile(script_filename, namespace, namespace)
    File "/usr/local/lib/python2.7/dist-packages/Django-1.5-py2.7.egg/EGG-INFO/scripts/", line 5, in
    File "/usr/local/lib/python2.7/dist-packages/Django-1.5-py2.7.egg/django/core/management/", line 453, in execute_from_command_line
    File "/usr/local/lib/python2.7/dist-packages/Django-1.5-py2.7.egg/django/core/management/", line 392, in execute
    File "/usr/local/lib/python2.7/dist-packages/Django-1.5-py2.7.egg/django/core/management/", line 272, in fetch_command
    klass = load_command_class(app_name, subcommand)
    File "/usr/local/lib/python2.7/dist-packages/Django-1.5-py2.7.egg/django/core/management/", line 77, in load_command_class
    module = import_module('' % (app_name, name))
    File "/usr/local/lib/python2.7/dist-packages/Django-1.5-py2.7.egg/django/utils/", line 35, in import_module
    File "/usr/local/lib/python2.7/dist-packages/Django-1.5-py2.7.egg/django/core/management/commands/", line 8, in
    from import custom_sql_for_model, emit_post_sync_signal
    File "/usr/local/lib/python2.7/dist-packages/Django-1.5-py2.7.egg/django/core/management/", line 9, in
    from django.db import models
    File "/usr/local/lib/python2.7/dist-packages/Django-1.5-py2.7.egg/django/db/", line 11, in
    if settings.DATABASES and DEFAULT_DB_ALIAS not in settings.DATABASES:
    File "/usr/local/lib/python2.7/dist-packages/Django-1.5-py2.7.egg/django/conf/", line 52, in __getattr__
    File "/usr/local/lib/python2.7/dist-packages/Django-1.5-py2.7.egg/django/conf/", line 47, in _setup
    self._wrapped = Settings(settings_module)
    File "/usr/local/lib/python2.7/dist-packages/Django-1.5-py2.7.egg/django/conf/", line 130, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
    File "/usr/local/lib/python2.7/dist-packages/Django-1.5-py2.7.egg/django/utils/", line 35, in import_module
    File "/var/www/mybooktype/", line 213, in
    BOOKTYPE_CONFIG = config.loadConfiguration()
    File "/usr/local/src/Booktype/lib/booki/utils/", line 72, in loadConfiguration
    data = readConfiguration()
    File "/usr/local/src/Booktype/lib/booki/utils/", line 40, in readConfiguration
    configPath = '%s/configuration.json' % settings.BOOKI_ROOT
    File "/usr/local/lib/python2.7/dist-packages/Django-1.5-py2.7.egg/django/conf/", line 52, in __getattr__
    File "/usr/local/lib/python2.7/dist-packages/Django-1.5-py2.7.egg/django/conf/", line 47, in _setup
    self._wrapped = Settings(settings_module)
    File "/usr/local/lib/python2.7/dist-packages/Django-1.5-py2.7.egg/django/conf/", line 147, in __init__
    setattr(self, setting, setting_value)
    File "/usr/local/lib/python2.7/dist-packages/Django-1.5-py2.7.egg/django/conf/", line 112, in __setattr__
    raise ImproperlyConfigured("If set, %s must end with a slash" % name)
    django.core.exceptions.ImproperlyConfigured: If set, MEDIA_URL must end with a slash

    Post edited by mickfuzz at 2013-03-23 17:40:25
  • 6 Comments sorted by
  • Hi Micz!

    I already answered on the mailing list but will do it just in case someone else has the same issue.

    You should read official documentation just because it is up to date:
     - file doc/deployment/

    Error message is very descriptive where the problem is :)
    django.core.exceptions.ImproperlyConfigured: If set, MEDIA_URL must end with a slash

    You are using Django 1.5 which throws error if MEDIA_URL does not end with a slash. In previous versions it was not suppose to end with slash and in 1.4 it just showed warning. You should manually update it (together with all other things which have changed in Django 1.5) or just read official install documentation. 


  • Thanks! This works great.
    Now just need to get my head around mod_wsgi!
  • Coming across this error and in I notice that MEDIA_URL then links to DATA_URL even though 2 lines above, it is commented as "obsolete".  Does anyone have trailheads on the Django 1.5 adjustments which must be made to get booktype to work?  I can walk backwards thru the various references in the file but would prefer not to duplicate.  TIA, V.
  • Should have mentioned using Ubuntu 13.04 and stuck at the booki.env step whereas settings remain incorrect.  Thanks.
  • FWIW: just adding backslash to the following allows one to proceed:

  • Booktype 2.0 (current development version) is really Django 1.5 and Django 1.6 friendly. Besides needing to put backslash in couple of options there are also changes in the API.

    Considering this, and like it is mentioned in the documentation, it is best to use virtual environment and packages from pip for deployment. Installing non supported version of Django and other packages can lead to unwanted problems and possible clashes with other packages on the system.