[doc] Need for better documentation on setup and usage of MySQL

Issue #67 new
Teo Tei created an issue

I followed the installation and setup instructions step by step

When it comes to: http://kallithea.readthedocs.org/en/latest/setup.html#setup

I selected MySQL as the database by editing production.ini as suggested, and I get errors when running setup-db:

# paster setup-db production.ini 
Running setup_app() from kallithea.websetup
Traceback (most recent call last):
  File "/opt/kallithea-venv/bin/paster", line 9, in <module>
    load_entry_point('PasteScript==1.7.5', 'console_scripts', 'paster')()
  File "/opt/kallithea-venv/local/lib/python2.7/site-packages/paste/script/command.py", line 104, in run
    invoke(command, command_name, options, args[1:])
  File "/opt/kallithea-venv/local/lib/python2.7/site-packages/paste/script/command.py", line 143, in invoke
    exit_code = runner.run(args)
  File "/opt/kallithea-venv/local/lib/python2.7/site-packages/paste/script/appinstall.py", line 68, in run
    return super(AbstractInstallCommand, self).run(new_args)
  File "/opt/kallithea-venv/local/lib/python2.7/site-packages/paste/script/command.py", line 238, in run
    result = self.command()
  File "/opt/kallithea-venv/local/lib/python2.7/site-packages/kallithea/lib/paster_commands/setup_db.py", line 108, in command
    self, config_file, section, self.sysconfig_install_vars(installer))
  File "/opt/kallithea-venv/local/lib/python2.7/site-packages/paste/script/appinstall.py", line 598, in setup_config
    mod.setup_app, command, filename, section, vars)
  File "/opt/kallithea-venv/local/lib/python2.7/site-packages/paste/script/appinstall.py", line 614, in _call_setup_app
    func(command, conf, vars)
  File "/opt/kallithea-venv/local/lib/python2.7/site-packages/kallithea/websetup.py", line 42, in setup_app
    tests=False, cli_args=command.options.__dict__)
  File "/opt/kallithea-venv/local/lib/python2.7/site-packages/kallithea/lib/db_manage.py", line 72, in __init__
    self.init_db(SESSION=SESSION)
  File "/opt/kallithea-venv/local/lib/python2.7/site-packages/kallithea/lib/db_manage.py", line 84, in init_db
    engine = create_engine(self.dburi, echo=self.log_sql)
  File "/opt/kallithea-venv/local/lib/python2.7/site-packages/sqlalchemy/engine/__init__.py", line 338, in create_engine
    return strategy.create(*args, **kwargs)
  File "/opt/kallithea-venv/local/lib/python2.7/site-packages/sqlalchemy/engine/strategies.py", line 64, in create
    dbapi = dialect_cls.dbapi(**dbapi_args)
  File "/opt/kallithea-venv/local/lib/python2.7/site-packages/sqlalchemy/connectors/mysqldb.py", line 52, in dbapi
    return __import__('MySQLdb')
ImportError: No module named MySQLdb

This seems a trivial issue: a missing module (is it a python module or what?) However, if this module is needed it should have been installed when installing kallithea. If that can't be done for whatever reason, the installation instructions should indicate this dependency. Finally, the error message should give proper instructions of what should be installed and how.

Comments (5)

  1. Teo Tei reporter

    First of all, one has to figure out the name of the pip package to install in the first place. Because "pip install MySWLdb" just told me such package does not exist. I found out there was a pymysql, but installing that alone (which succeeded without any issue) didn't change a thing. Also "apt-get install python-mysqldb" didn't solve the issue (and then I was left to wonder, is this actually the correct package but perhaps it isn't working because kallithea is in a virtualenv while apt get installs the module "outside" it? Will never know)

    The workaround that finally worked (or seemed to work) for me was this one: http://stackoverflow.com/questions/22252397/importerror-no-module-named-mysqldb#answer-22252975 i.e. pip install mymysql + change the mysql uri to mysql+pymysql:// instead of just mysql://

    But then I got scared about the "all existing databases are going to be destroyed" warning and decided to go ahead with sqllite.

  2. pyloor

    mysqldb seems to be discontinued. pymsql's target is to create a mysqldb drop-in replacement. i am new to kallithea as a leaving rhodecode user. at the moment i look around to see how i can help :)

  3. Log in to comment