Ask Your Question
2

syncdb can't create admin in Django >= 1.5

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

6455260 gravatar image

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

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 mnage.py 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

Comments

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

Evgeny gravatar imageEvgeny ( 2013-10-30 14:19:12 -0600 )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 manage.py 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 manage.py 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 image6455260 ( 2013-10-30 15:58:18 -0600 )edit

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

6455260 gravatar image6455260 ( 2013-10-30 16:05:54 -0600 )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: http://askbot.org/doc/initialize-database-tables.html, and run `python manage.py syncdb`, the following is the output:

Syncing...
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 imagesgon00 ( 2013-11-04 03:41:52 -0600 )edit
1

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

Dr.Dran gravatar imageDr.Dran ( 2013-11-09 09:18:54 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

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

thinkwell gravatar image

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

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 manage.py migrate askbot

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

  python manage.py runserver `hostname -i`:8000

At least it works for you me...

edit flag offensive delete link more

Comments

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

Evgeny gravatar imageEvgeny ( 2013-11-25 14:24:01 -0600 )edit

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

Evgeny gravatar imageEvgeny ( 2013-11-25 14:26:24 -0600 )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

3 followers

Stats

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

Seen: 2,062 times

Last updated: Nov 25 '13