Cannot create DB in MySQL

Asked by Steve Keller

I need to setup a MySQL database for Graphite, as we will be clustering 3 servers. I set up the database following the commented examples in (of course I created the database first using MySQL), then ran syncdb.

This succeeds, but actually creates the database in sqlite. When I hit the graphite web page, I see the following exception:

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/django/core/handlers/", line 101, in get_response
  File "/usr/lib/python2.7/site-packages/django/core/", line 252, in resolve
    sub_match = pattern.resolve(new_path)
  File "/usr/lib/python2.7/site-packages/django/core/", line 158, in resolve
    return ResolverMatch(self.callback, args, kwargs,
  File "/usr/lib/python2.7/site-packages/django/core/", line 164, in _get_callback
    self._callback = get_callable(self._callback_str)
  File "/usr/lib/python2.7/site-packages/django/utils/", line 124, in wrapper
    result = func(*args)
  File "/usr/lib/python2.7/site-packages/django/core/", line 91, in get_callable
    lookup_view = getattr(import_module(mod_name), func_name)
  File "/usr/lib/python2.7/site-packages/django/utils/", line 35, in import_module
  File "/opt/graphite/webapp/graphite/browser/", line 20, in <module>
    from graphite.util import getProfile, getProfileByUsername, defaultUser, json
  File "/opt/graphite/webapp/graphite/", line 55, in <module>
    defaultUser = User.objects.get(username='default')
  File "/usr/lib/python2.7/site-packages/django/db/models/", line 132, in get
    return self.get_query_set().get(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/django/db/models/", line 344, in get
    num = len(clone)
  File "/usr/lib/python2.7/site-packages/django/db/models/", line 82, in __len__
    self._result_cache = list(self.iterator())
  File "/usr/lib/python2.7/site-packages/django/db/models/", line 273, in iterator
    for row in compiler.results_iter():
  File "/usr/lib/python2.7/site-packages/django/db/models/sql/", line 680, in results_iter
    for rows in self.execute_sql(MULTI):
  File "/usr/lib/python2.7/site-packages/django/db/models/sql/", line 735, in execute_sql
    cursor.execute(sql, params)
  File "/usr/lib/python2.7/site-packages/django/db/backends/mysql/", line 86, in execute
    return self.cursor.execute(query, args)
  File "/usr/lib/python2.7/site-packages/MySQLdb/", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/lib/python2.7/site-packages/MySQLdb/", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
DatabaseError: (1146, "Table 'graphite.auth_user' doesn't exist")

I guess this is a bug, but I'm hoping an answer will be forthcoming.

We are running Graphite 0.9.10, installed via pip.

Steve Keller
<email address hidden>

Question information

English Edit question
Graphite Edit question
No assignee Edit question
Solved by:
Steve Keller
Last query:
Last reply:
Revision history for this message
Steve Keller (skeller-ea) said :

Forgot to add - if I remove the database definition from, Graphite works fine.

Revision history for this message
Steve Keller (skeller-ea) said :

Also, I tried both ways of setting the database parameters - dictionary and DATABASE_XXX values. Neither worked.

Revision history for this message
Michael Leinartas (mleinartas) said :

I believe this is a problem with how is loading after a recent refactor. A workaround is to run ' syncdb --settings=settings'

The bug with will be resolved before 0.9.10 is fully released

Revision history for this message
Steve Keller (skeller-ea) said :

Thanks Michael, that worked. However - there are still other issues.

First, and I will file a bug for this, I do not believe that it is wise for pip to install pre-releases. Here is what I just found (on my dev server):

[root@esmdev01 ~]# pip install graphite-web
Downloading/unpacking graphite-web
  Downloading graphite-web-0.9.10-pre2.tar.gz (2.1Mb): 2.1Mb downloaded

The site lists 0.9.9 as the current version.

Second, I found this bug after installing the database and attempting to look at the admin pages (I will file this as well...)

File "/usr/lib/python2.7/site-packages/django/core/", line 167, in _get_callback
    raise ViewDoesNotExist("Could not import %s. Error was: %s" % (mod_name, str(e)))
ViewDoesNotExist: Could not import Error was: No module named simplejson