Hmm... strange.
I get a strange error when I tried to do this....
Something about a django_content_type  relation which I don't have.
This probably happens when the "app" gets registerd in the auth
system.
Same error with both postgresql and sqlite3.

Databases are configured like this..
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'mydata',                      # Or path to database
file if using sqlite3.
        'USER': 'postgres',                      # Not used with
sqlite3.
        'PASSWORD': 'supersecret',                  # Not used with
sqlite3.
        'HOST': 'localhost',                      # Set to empty
string for localhost. Not used with sqlite3.
        'PORT': '',                      # Set to empty string for
default. Not used with sqlite3.
    },
    'ads': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'mydata_ads',
        'USER': 'postgres',                      # Not used with
sqlite3.
        'PASSWORD': 'supersecret',                  # Not used with
sqlite3.
        'HOST': 'localhost',                      # Set to empty
string for localhost. Not used with sqlite3.
        'PORT': '',
    }
}

Running a ./manage.py syncdb works as a dream but doesn't include the
adds app because of the router previously mentioned.

Here is what happens when I try to sync a database/app called ads.
./manage.py syncdb --database=ads
Creating table ads_entry
Traceback (most recent call last):
  File "./manage.py", line 11, in <module>
    execute_manager(settings)
  File "/home/peterm/python/dalsland/local/py/lib/python2.6/site-
packages/django/core/management/__init__.py", line 438, in
execute_manager
    utility.execute()
  File "/home/peterm/python/dalsland/local/py/lib/python2.6/site-
packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/peterm/python/dalsland/local/py/lib/python2.6/site-
packages/django/core/management/base.py", line 195, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/peterm/python/dalsland/local/py/lib/python2.6/site-
packages/django/core/management/base.py", line 222, in execute
    output = self.handle(*args, **options)
  File "/home/peterm/python/dalsland/local/py/lib/python2.6/site-
packages/django/core/management/base.py", line 351, in handle
    return self.handle_noargs(**options)
  File "/home/peterm/python/dalsland/local/py/lib/python2.6/site-
packages/django/core/management/commands/syncdb.py", line 97, in
handle_noargs
    emit_post_sync_signal(created_models, verbosity, interactive, db)
  File "/home/peterm/python/dalsland/local/py/lib/python2.6/site-
packages/django/core/management/sql.py", line 190, in
emit_post_sync_signal
    interactive=interactive, db=db)
  File "/home/peterm/python/dalsland/local/py/lib/python2.6/site-
packages/django/dispatch/dispatcher.py", line 166, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/home/peterm/python/dalsland/local/py/lib/python2.6/site-
packages/django/contrib/contenttypes/management.py", line 12, in
update_contenttypes
    content_types = list(ContentType.objects.using(db).filter
(app_label=app.__name__.split('.')[-2]))
  File "/home/peterm/python/dalsland/local/py/lib/python2.6/site-
packages/django/db/models/query.py", line 81, in __len__
    self._result_cache.extend(list(self._iter))
  File "/home/peterm/python/dalsland/local/py/lib/python2.6/site-
packages/django/db/models/query.py", line 267, in iterator
    for row in compiler.results_iter():
  File "/home/peterm/python/dalsland/local/py/lib/python2.6/site-
packages/django/db/models/sql/compiler.py", line 685, in results_iter
    for rows in self.execute_sql(MULTI):
  File "/home/peterm/python/dalsland/local/py/lib/python2.6/site-
packages/django/db/models/sql/compiler.py", line 740, in execute_sql
    cursor.execute(sql, params)
  File "/home/peterm/python/dalsland/local/py/lib/python2.6/site-
packages/django/db/backends/util.py", line 19, in execute
    return self.cursor.execute(sql, params)
  File "/home/peterm/python/dalsland/local/py/lib/python2.6/site-
packages/django/db/backends/postgresql_psycopg2/base.py", line 44, in
execute
    return self.cursor.execute(query, args)
django.db.utils.DatabaseError: relation "django_content_type" does not
exist
LINE 1: ..."."app_label", "django_content_type"."model" FROM
"django_co..



On Feb 3, 1:16 pm, Russell Keith-Magee <freakboy3...@gmail.com> wrote:
> On Wed, Feb 3, 2010 at 3:53 AM, kmpm <pe...@birchroad.net> wrote:
> > Wouldn't a database router like this sort of do the thing for now...
>
> Yes - this is exactly what a router is designed for.
>
> At the time I posted my last reply, routers didn't exist yet. I had to
> implement routers in order to solve some other problems, but along the
> way, I ended up implementing most of the stuff that I thought we would
> need to defer to v1.3.
>
> Yours
> Russ Magee %-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to