Error installing Book Type when it comes to syncdb
  • I'm following the instructions here. http://en.flossmanuals.net/booktype/installation-on-gnulinux/

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



    django-admin.py 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.
    Thnkx.




    Traceback (most recent call last):
    File "/usr/local/bin/django-admin.py", line 5, in
    pkg_resources.run_script('Django==1.5', '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.5-py2.7.egg/EGG-INFO/scripts/django-admin.py", line 5, in
    management.execute_from_command_line()
    File "/usr/local/lib/python2.7/dist-packages/Django-1.5-py2.7.egg/django/core/management/__init__.py", line 453, in execute_from_command_line
    utility.execute()
    File "/usr/local/lib/python2.7/dist-packages/Django-1.5-py2.7.egg/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
    File "/usr/local/lib/python2.7/dist-packages/Django-1.5-py2.7.egg/django/core/management/__init__.py", 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/__init__.py", line 77, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
    File "/usr/local/lib/python2.7/dist-packages/Django-1.5-py2.7.egg/django/utils/importlib.py", line 35, in import_module
    __import__(name)
    File "/usr/local/lib/python2.7/dist-packages/Django-1.5-py2.7.egg/django/core/management/commands/syncdb.py", line 8, in
    from django.core.management.sql 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/sql.py", line 9, in
    from django.db import models
    File "/usr/local/lib/python2.7/dist-packages/Django-1.5-py2.7.egg/django/db/__init__.py", 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/__init__.py", line 52, in __getattr__
    self._setup(name)
    File "/usr/local/lib/python2.7/dist-packages/Django-1.5-py2.7.egg/django/conf/__init__.py", 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/__init__.py", 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/importlib.py", line 35, in import_module
    __import__(name)
    File "/var/www/mybooktype/settings.py", line 213, in
    BOOKTYPE_CONFIG = config.loadConfiguration()
    File "/usr/local/src/Booktype/lib/booki/utils/config.py", line 72, in loadConfiguration
    data = readConfiguration()
    File "/usr/local/src/Booktype/lib/booki/utils/config.py", 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/__init__.py", line 52, in __getattr__
    self._setup(name)
    File "/usr/local/lib/python2.7/dist-packages/Django-1.5-py2.7.egg/django/conf/__init__.py", 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/__init__.py", 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/__init__.py", 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/Ubuntu.md

    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. 

    Aco 

  • Thanks! This works great.
    Now just need to get my head around mod_wsgi!
  • Coming across this error and in settings.py 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:

    STATIC_URL, DATA_URL
  • 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.

    Aco