Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8158249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:32:47+00:00 2026-06-06T17:32:47+00:00

When I issue the command: python manage.py syncdb –database=mydb It shows the output as

  • 0

When I issue the command:

python manage.py syncdb --database=mydb

It shows the output as follows…

Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table django_content_type
Traceback (most recent call last):
File "manage.py", line 14, in <module>
    execute_manager(settings)
File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 459,     in execute_manager
    utility.execute()
File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 382,     in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 196, in     run_from_argv
    self.execute(*args, **options.__dict__)
File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 232, in     execute
    output = self.handle(*args, **options)
File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 371, in     handle
    return self.handle_noargs(**options)
File "/usr/lib/python2.7/site-packages/django/core/management/commands/syncdb.py",     line 110, in handle_noargs
    emit_post_sync_signal(created_models, verbosity, interactive, db)
File "/usr/lib/python2.7/site-packages/django/core/management/sql.py", line 189, in     emit_post_sync_signal
    interactive=interactive, db=db)
File "/usr/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 172, in     send
    response = receiver(signal=self, sender=sender, **named)
File "/usr/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py",     line 35, in create_permissions
    ctype = ContentType.objects.get_for_model(klass)
File "/usr/lib/python2.7/site-packages/django/contrib/contenttypes/models.py", line     42, in get_for_model
    defaults = {'name': smart_unicode(opts.verbose_name_raw)},
File "/usr/lib/python2.7/site-packages/django/db/models/manager.py", line 134, in     get_or_create
    return self.get_query_set().get_or_create(**kwargs)
File "/usr/lib/python2.7/site-packages/django/db/models/query.py", line 442, in     get_or_create
    return self.get(**lookup), False
File "/usr/lib/python2.7/site-packages/django/db/models/query.py", line 361, in get
    num = len(clone)
File "/usr/lib/python2.7/site-packages/django/db/models/query.py", line 85, in     __len__
    self._result_cache = list(self.iterator())
File "/usr/lib/python2.7/site-packages/django/db/models/query.py", line 291, in     iterator
    for row in compiler.results_iter():
File "/usr/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 763,     in results_iter
    for rows in self.execute_sql(MULTI):
File "/usr/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line     818, in     execute_sql
    cursor.execute(sql, params)
File "/usr/lib/python2.7/site-packages/django/db/backends/util.py", line 40, in     execute
    return self.cursor.execute(sql, params)
File "/usr/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line     337, in     execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.DatabaseError: no such table: django_content_type

I have a custom db router that is basically set to django’s example, except i have a custom attribute on MY models so that it knows which database they default to. syncdb works when in my settings.py INSTALLED_APPS I comment out: django.contrib.auth and django.contrib.contenttypes. Had this problem for a while, but have been putting it off until now, when I need to start on authentication. If you want my db router I’ll post also

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T17:32:49+00:00Added an answer on June 6, 2026 at 5:32 pm

    I’ve explained a similar problem here:
    django.db.utils.IntegrityError: (1062, "Duplicate entry '22-add_' for key 'content_type_id'")

    You don’t need to comment out contrib.auth and contrib.contenttypes. Just make sure all django models – users, sessions, permissions are only used in 1 database, which could be considered as a master.

    This will not directly solve your problem, but can be a starting point when dealing with multiple db’s and db routers. What you need to know is that each model has it’s content type in the database.
    The problem occur when django objects – user/session/permission are not restricted to a single database – then they are created into each database. And since a content-type makes a model unique, having content-types for a single type in multiple databases could lead to the problem explained in the other SO question above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am new to python, on my Mac, when i issue command User:ihasfriendz user$
Within a python script, I want to issue a command. In perl, I could
I have a Python script that needs to issue a number of shell commands.
I most likely have a syntax issue (SQL command and error copied below) -
How can I ignore the attribute error I get when I issue this command?
Can anyone tell me if I can (in the command line) issue a POST
I want to issue a series of Command executions, but only when the prior
I am having an issue with the most simple command in SQL Server Management.
I am having a weird issue with nuget.exe command line tool. I have a
I have a spork gem issue. Every time I run the spork command I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.