Ask Your Question
1

NameError: global name 'User' is not defined (Fresh install) (askbot only)

asked 2013-11-04 04:22:14 -0500

sgon00 gravatar image

updated 2013-11-06 23:12:38 -0500

Please check the following exact steps that I run for creating askbot environment:

$ virtualenv askbot
$ cd askbot/
$ . bin/activate
$ pip install yolk
$ pip install askbot
$ pip install psycopg2
$ sudo -u postgres createuser -D -R -S -P user1
$ sudo -u postgres createdb -O user1 userdb
$ mkdir testproject
$ cd testproject
$ askbot-setup
$ python manage.py collectstatic
$ python manage.py syncdb
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 django_content_type
Creating table django_session
Creating table django_site
Creating table django_admin_log
Creating table south_migrationhistory
Creating table livesettings_setting
Creating table livesettings_longsetting
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

The output of yolk -l:

$ yolk -l 
Coffin          - 0.3.8        - active 
Django          - 1.5          - active 
Jinja2          - 2.7.1        - active 
MarkupSafe      - 0.18         - active 
Python          - 2.7.3        - active development (/usr/lib/python2.7/lib-dynload)
South           - 0.8.2        - active 
Unidecode       - 0.04.14      - active 
akismet         - 0.2.0        - active 
amqp            - 1.0.13       - active 
anyjson         - 0.3.3        - active 
argparse        - 1.2.1        - active development (/usr/lib/python2.7)
askbot          - 0.7.49       - active 
beautifulsoup4  - 4.3.2        - active 
billiard        - 2.7.3.34     - active 
celery          - 3.0.24       - active 
chardet         - 2.1.1        - active 
django-appconf  - 0.6          - active 
django-celery   - 3.0.11       - active 
django-compressor - 1.2          - active 
django-countries - 1.0.5        - active 
django-followit - 0.0.3        - active 
django-keyedcache - 1.4-6        - active 
django-kombu    - 0.9.4        - active 
django-picklefield - 0.3.0        - active 
django-recaptcha-works - 0.3.4        - active 
django-robots   - 0.9.2        - active 
django-threaded-multihost - 1.4-1        - active 
django-tinymce  - 1.5.1b2      - active 
html5lib        - 0.90         - active 
httplib2        - 0.8          - active 
kombu           - 2.5.16       - active 
lamson          - 1.3.4        - active 
lockfile        - 0.9.1        - active 
longerusername  - 0.4          - active 
markdown2       - 2.1.0        - active 
mock            - 1.0.1        - active 
nose            - 1.3.0        - active 
oauth2          - 1.5.211      - active 
pip             - 1.3.1        - active 
psycopg2        - 2.5.1        - active 
pystache        - 0.3.1        - active 
python-daemon   - 1.6          - active 
python-dateutil - 2.2          - active 
python-modargs  - 1.7          - active 
python-openid   - 2.2.5        - active 
pytz            - 2013.7       - active 
sanction        - 0.3.1        - active 
setuptools      - 0.6c11       - active 
six             - 1.4.1        - active 
wsgiref         - 0.1.2        - active development (/usr/lib/python2.7)
yolk            - 0.4.3        - active 

PS: I should mention that you can see from the above steps, I followed the steps from official installation documentation: nolink://askbot.org/doc/install.html And the final step here python manage.py syncdb is mentioned in this link: nolink://askbot.org/doc/initialize-database-tables.html

Changed in version 0.7.21: When the script asks you if you want to create a superuser, answer yes if you want to create one. By default Askbot sets admin status(superuser) for the first user created automatically but also supports this form.

Updated ...

(more)
edit retag flag offensive close merge delete

Comments

Can anyone help please? I stop here and do not know what to do. I followed the exact steps from official installation documentation. THANKS.

sgon00 gravatar imagesgon00 ( 2013-11-05 00:25:06 -0500 )edit

Same here ... I will work on this problem today! Gotta make it work!

Raony Guimarães gravatar imageRaony Guimarães ( 2013-11-08 06:52:21 -0500 )edit

I am getting something similar- brand new install python 2.7, postgresql 9.3, linux. homepage shows up find, but when i click sign in, i get an error: column askbot_anonymousquestion.is_anonymous does not exist LINE 1: ..."."title", "askbot_anonymousquestion"."tagnames", "askbot_an... so something is wrong with the migrations. I have tried doing syncdb --all, and migrate askbot, migrate django_authopenid

jeffmad gravatar imagejeffmad ( 2013-11-09 16:57:13 -0500 )edit

I'm having the same issue. I skipped over it and haven't found any side affects yet.

JStarcher gravatar imageJStarcher ( 2013-11-12 23:15:42 -0500 )edit

2 Answers

Sort by » oldest newest most voted
0

answered 2013-11-13 00:47:43 -0500

jeffmad gravatar image

I just did a new install with latest from askbot on github. The machine is a new linux box with python 2.7 and postgresql 9.3. Everything went well until I did python manage.py syncdb and python manage.py migrate askbot

I received DataBaseError 17 times, usually because a Constraint already existed and thus could not be created again, or because it did not exist and therefore could not be dropped. To get around this, I kept psql running and manually dropped a database constraint if required (alter table foo drop constraint bar) or I would open the migration file and comment out code that was trying to remove constraints that did not exist. Then I would run the migration again and it would succeed.

I also received many harmless "fatal errors" in the migrations, usually for adding a column that already existed. Overall it was not fun, but I am glad it is over.

The most difficult part was getting askbot to run under gunicorn, as it could not find the wsgi.py file and thus would not start. I finally found a solution to add an entry in the gunicorn_conf.py file.

pythonpath='/opt/askbot/deploy'
raw_env='DJANGO_SETTINGS_MODULE=settings'

I have nginx proxying requests back to gunicorn, which is running under supervisord. Now all is well on this box, but still more work to do with LDAP authentication.

edit flag offensive delete link more
0

answered 2014-02-10 10:37:41 -0500

spascoe gravatar image

My diagnosis is that the module django.contrib.auth.management.commands.createsuperuser no longer exports the User model. The module askbot.management.commands.createsuperuser expects this in the code.

If you remove the askbot.management.commands.createsuperuser module you can use the default Django createsuperuser command. It seems to work provided you initially answer "no" when running syncdb and run createsuperuser separately after migrating.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

2 followers

Stats

Asked: 2013-11-04 04:22:14 -0500

Seen: 3,199 times

Last updated: Feb 10 '14