Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create superuser with "openmooc-moocng-admin syncdb" is broken. #65

Open
jlsalvador opened this issue May 5, 2014 · 3 comments
Open

Comments

@jlsalvador
Copy link
Contributor

If you ask "yes" to the question "Would you like to create one now? (yes/no)", the script fails:

You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Username (leave blank to use 'root'): 
E-mail address: [email protected]
Password: 
Password (again): 
Traceback (most recent call last):
  File "/usr/bin/openmooc-moocng-admin", line 12, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib/python2.6/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python2.6/site-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python2.6/site-packages/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/lib/python2.6/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/python2.6/site-packages/django/core/management/base.py", line 371, in handle
    return self.handle_noargs(**options)
  File "/usr/lib/python2.6/site-packages/south/management/commands/syncdb.py", line 90, in handle_noargs
    syncdb.Command().execute(**options)
  File "/usr/lib/python2.6/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/python2.6/site-packages/django/core/management/base.py", line 371, in handle
    return self.handle_noargs(**options)
  File "/usr/lib/python2.6/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.6/site-packages/django/core/management/sql.py", line 189, in emit_post_sync_signal
    interactive=interactive, db=db)
  File "/usr/lib/python2.6/site-packages/django/dispatch/dispatcher.py", line 172, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/usr/lib/python2.6/site-packages/django/contrib/auth/management/__init__.py", line 73, in create_superuser
    call_command("createsuperuser", interactive=True, database=db)
  File "/usr/lib/python2.6/site-packages/django/core/management/__init__.py", line 150, in call_command
    return klass.execute(*args, **defaults)
  File "/usr/lib/python2.6/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/python2.6/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 124, in handle
    User.objects.db_manager(database).create_superuser(username, email, password)
  File "/usr/lib/python2.6/site-packages/django/contrib/auth/models.py", line 164, in create_superuser
    u = self.create_user(username, email, password)
  File "/usr/lib/python2.6/site-packages/django/contrib/auth/models.py", line 160, in create_user
    user.save(using=self._db)
  File "/usr/lib/python2.6/site-packages/django/db/models/base.py", line 463, in save
    self.save_base(using=using, force_insert=force_insert, force_update=force_update)
  File "/usr/lib/python2.6/site-packages/django/db/models/base.py", line 565, in save_base
    created=(not record_exists), raw=raw, using=using)
  File "/usr/lib/python2.6/site-packages/django/dispatch/dispatcher.py", line 172, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/usr/lib/python2.6/site-packages/moocng/profile/models.py", line 44, in create_user_profile
    profile = instance.get_profile()
  File "/usr/lib/python2.6/site-packages/django/contrib/auth/models.py", line 400, in get_profile
    self._state.db).get(user__id__exact=self.id)
  File "/usr/lib/python2.6/site-packages/django/db/models/query.py", line 361, in get
    num = len(clone)
  File "/usr/lib/python2.6/site-packages/django/db/models/query.py", line 85, in __len__
    self._result_cache = list(self.iterator())
  File "/usr/lib/python2.6/site-packages/django/db/models/query.py", line 291, in iterator
    for row in compiler.results_iter():
  File "/usr/lib/python2.6/site-packages/django/db/models/sql/compiler.py", line 763, in results_iter
    for rows in self.execute_sql(MULTI):
  File "/usr/lib/python2.6/site-packages/django/db/models/sql/compiler.py", line 818, in execute_sql
    cursor.execute(sql, params)
  File "/usr/lib/python2.6/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 52, in execute
    return self.cursor.execute(query, args)
django.db.utils.DatabaseError: relation "profile_userprofile" does not exist
LINE 1: ..."profile_userprofile"."last_announcement_id" FROM "profile_u...
@neokore
Copy link

neokore commented Jul 18, 2014

Hello, José Luis.
I'm trying to install OpenMOOC from the sources in Ubuntu, but I'm stuck in this bug.
Is there any known workaround to continue? If not, I guess I have to try creating the superuser by hand.

Thanks!

@jlsalvador
Copy link
Contributor Author

Hello @neokore

See https://github.com/OpenMOOC/documentation/blob/master/source/configure/moocng.rst#copy-the-static-files about how to trick this issue.

openmooc-moocng-admin syncdb

openmooc-moocng-admin migrate

openmooc-moocng-admin createsuperuser --username=root --email=[email protected]

I think that these issues will be fixed before we reach the end of the month.

@neokore
Copy link

neokore commented Jul 22, 2014

Thank you @jlsalvador, it worked, but changing the command names:
openmooc-moocng-admin syncdb => django-admin.py syncdb --settings=moocng.settings
openmooc-moocng-admin migrate => ./manage.py migrate
openmooc-moocng-admin createsuperuser --username=root [email protected] => ./manage.py createsuperuser --username=root [email protected]

That's because I don't have the openmooc-moocng-admin script file (I created it later).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants