Ask Your Question

syncdb can't create admin in Django >= 1.5

asked 2013-10-30 12:44:22 -0500

6455260 gravatar image

updated 2013-10-30 14:19:33 -0500

Evgeny gravatar image

Hello, I installed askbot as a part of my project, and it works pretty well but I recently noticed a problem in the admin creation phase when running (python syncdb) I get this error : NameError: "global name 'User' is not defined"

I tried Django 1.5, 1.5.4 and I still have same problem I had no problems with django 1.4

Any ideas what is the problem?

edit retag flag offensive close merge delete


Which commands do you type? Can you reproduce this issue with "askbot-only" installation?

Evgeny gravatar image Evgeny  ( 2013-10-30 14:19:12 -0500 )edit

1- I installed askbot 2- I used django (1.5) as askbot-setup doesn't work for higher versions 3- I ran askbot-setup 4- I chose sqlite3, db name = database.db 5- I entered the standalone installation of askbot, and removed the database file (rm database.db) 6- I ran : python syncdb 7- I chose to add admin 8- I got the error : NameError: global name 'User' is not defined 9- I removed django 1.5 and installed django 1.4 10- I removed the database (rm database.db) 11- I ran : python syncdb 12 when prompted to add an admin, I chose YES and everything went OK and I was managed to add admin user successfull

6455260 gravatar image 6455260  ( 2013-10-30 15:58:18 -0500 )edit

btw, I tried to edit the previous comment and add new lines , but it seems askbot ignoring me :)

6455260 gravatar image 6455260  ( 2013-10-30 16:05:54 -0500 )edit

I am having the same problem. Fresh install askbot in a vritualenv (askbot only). Followed all the official documetnation installation steps. `pip install askbot`. when I follow this step:, and run `python syncdb`, the following is the output:

Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_groups
Creating table auth_user_user_permissions
Creating table auth_user
Creating table auth_message
Creating table djkombu_queue
Creating table djkombu_message
Creating table followit_followuser

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
NameError: global name 'User' is not defined

sgon00 gravatar image sgon00  ( 2013-11-04 03:41:52 -0500 )edit

I have the same problem with a brand new installation of askbot and postgresql

Dr.Dran gravatar image Dr.Dran  ( 2013-11-09 09:18:54 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-11-15 18:25:06 -0500

thinkwell gravatar image

updated 2013-11-25 14:24:28 -0500

Evgeny gravatar image

I had the same problem on a new install of askbot & postgresql. Make sure that you answer NO to creating an admin account. After getting the NameError: global name 'User' is not defined, run:

  python migrate askbot

You'll get lots of errors but after completion, you should be able to launch the site with:

  python runserver `hostname -i`:8000

At least it works for you me...

edit flag offensive delete link more


This may be due to our patching the `auth.User` model and django's new way of allowing custom user models.

Evgeny gravatar image Evgeny  ( 2013-11-25 14:24:01 -0500 )edit

Also you can use command `python syncdb --migrate --noinput`. This migrates and syncdb's in one and avoids the create admin issue.

Evgeny gravatar image Evgeny  ( 2013-11-25 14:26:24 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2013-10-30 12:44:22 -0500

Seen: 2,290 times

Last updated: Nov 25 '13