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

  • Home
  • SEARCH
  • 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 7520233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:01:58+00:00 2026-05-30T02:01:58+00:00

The traceback is on a ”’python manage.py syncdb”’, and happens immediately after the password

  • 0

The traceback is on a ”’python manage.py syncdb”’, and happens immediately after the password is entered twice. The database is sqlite3.

The traceback is:

Traceback (most recent call last):
  File "manage.py", line 14, in <module>
    execute_manager(settings)
  File "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/management/base.py", line 351, in handle
    return self.handle_noargs(**options)
  File "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 109, in handle_noargs
    emit_post_sync_signal(created_models, verbosity, interactive, db)
  File "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/management/sql.py", line 190, in emit_post_sync_signal
    interactive=interactive, db=db)
  File "/usr/local/Cellar/python/2.7/lib/python2.7/site-    packages/django/dispatch/dispatcher.py", line 172, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py", line 70, in create_superuser
    call_command("createsuperuser", interactive=True)
  File "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 166, in call_command
return klass.execute(*args, **defaults)
  File "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 134, in handle
    User.objects.create_superuser(username, email, password)
  File "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/contrib/auth/models.py", line 140, in create_superuser
    u = self.create_user(username, email, password)
  File "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/contrib/auth/models.py", line 136, in create_user
    user.save(using=self._db)
  File "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/db/models/base.py", line 460, in save
    self.save_base(using=using, force_insert=force_insert, force_update=force_update)
  File "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/db/models/base.py", line 570, in save_base
    created=(not record_exists), raw=raw, using=using)
  File "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 172, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/Users/jonathan/pim/accounts/models.py", line 12, in create_user_profile
    UserProfile.objects.create(user = instance)
  File "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/db/models/manager.py", line 138, in create
    return self.get_query_set().create(**kwargs)
  File "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/db/models/query.py", line 360, in create
    obj.save(force_insert=True, using=self.db)
  File "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/db/models/base.py", line 460, in save
    self.save_base(using=using, force_insert=force_insert, force_update=force_update)
  File "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/db/models/base.py", line 553, in save_base
    result = manager._insert(values, return_id=update_pk, using=using)
  File "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/db/models/manager.py", line 195, in _insert
    return insert_query(self.model, values, **kwargs)
  File "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/db/models/query.py", line 1436, in insert_query
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 791, in execute_sql
    cursor = super(SQLInsertCompiler, self).execute_sql(None)
  File "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 735, in execute_sql
    cursor.execute(sql, params)
  File "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/db/backends/util.py", line 34, in execute
    return self.cursor.execute(sql, params)
  File "/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 234, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.IntegrityError: column user_id is not unique

My models.py is below:

from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.db.models import ForeignKey
from django.db import models
from accounts.models import UserProfile

class CalendarEvent(models.Model):
    description = models.TextField()
    user_profile = models.ForeignKey(UserProfile)
    when = models.TextField()
    def __init__(self, when, description, user_profile):
        self.when = when
        self.description = description
        self.user_profile = user_profile
    def accepts(timestamp):
        if isinstance(timestamp, float):
            timestamp = time.asctime(time.localtime(timestamp))
        if timestamp[:4] == 'days':
            pass
        else:
            if re.match(self.when, timestamp):
                return True
            else:
                return False

Removing the underscore from all user_profile references does not change this behavior.

What am I doing wrong here and how can I fix it?

–EDIT–

The source for the project is at http://JonathansCorner.com/project/pim.tgz.

  • 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-05-30T02:01:59+00:00Added an answer on May 30, 2026 at 2:01 am

    You are connecting the User post_save signal twice, because you are importing the account models module on two different paths. This means you are trying to create two user profiles for your new super user, and it fails the second time.

    When Django imports the accounts app, the path for the models is accounts.models. However when django imports the pim ‘app’ (it isn’t really an app, it’s the project root, more on that later), the accounts.models module is imported again as pim.accounts.models.

    The quickest way to fix the problem is to use a unique identifier when connecting the post save signal.

    post_save.connect(create_user_profile, sender = User, dispatch_uid="create_user_profile")
    

    The better fix is to sort out your imports and project layout:

    • create a separate app for your models.py that contains the CalendarEvent model, instead of putting it in your project root.
    • you can name your app ‘pim’ inside your project ‘pim’ if you want
    • move your models.py, admin.py and possibly some if your urls to the new app

    If you are currently developing, then the easiest thing to do is to drop the user profile table and let syncdb recreate it. Alternatively you could delete the unneeded user profiles in the shell.

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

Sidebar

Related Questions

I run at a cloned Django repository python manage.py runserver I get Traceback (most
it gives me this error: Traceback (most recent call last): File C:\Users\Public\SoundLog\Code\Código Python\SoundLog\Plugins\NoisePlugin.py, line
I'm trying to install djangobb and when running manage.py syncdb it returns with Traceback
root@dicksonxavier-desktop:/home/dicksonxavier/Downloads/MySQL-python-1.2.3# python setup.py build sh: mysql_config: not found Traceback (most recent call last): File
(Written in Python shell) >>> o = object() >>> o.test = 1 Traceback (most
Am getting the below error when executing python protocols/smpp/test/test_post_upgrade.py: Traceback (most recent call last):
$ cat e.py raise Exception $ python e.py Traceback (most recent call last): File
I'm having trouble with python. I keep getting the same error: Traceback (most recent
I get this error: Traceback (most recent call last): File D:/Python26/PYTHON-PROGRAMME/049 bam, line 9,
I'm trying to use graphviz with python and I get the error: Traceback (most

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.