2

I am testing django-userena demo project. I have installed sendmail.

I see this error when I sign up:

Environment:


Request Method: POST
Request URL: http://127.0.0.1:8000/accounts/signup/

Django Version: 1.3.1
Python Version: 2.7.2
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.admin',
 'easy_thumbnails',
 'guardian',
 'south',
 'userena',
 'userena.contrib.umessages',
 'demo_project.profiles']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'userena.middleware.UserenaLocaleMiddleware')


Traceback:
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/userena/decorators.py" in _wrapped_view
  28.         return view_func(request, *args, **kwargs)
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/userena/views.py" in signup
  69.         if form.is_valid():
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/django/forms/forms.py" in is_valid
  121.         return self.is_bound and not bool(self.errors)
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/django/forms/forms.py" in _get_errors
  112.             self.full_clean()
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/django/forms/forms.py" in full_clean
  267.         self._clean_fields()
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/django/forms/forms.py" in _clean_fields
  287.                     value = getattr(self, 'clean_%s' % name)()
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/userena/forms.py" in clean_username
  49.             user = User.objects.get(username__iexact=self.cleaned_data['username'])
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/django/db/models/manager.py" in get
  132.         return self.get_query_set().get(*args, **kwargs)
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/django/db/models/query.py" in get
  344.         num = len(clone)
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/django/db/models/query.py" in __len__
  82.                 self._result_cache = list(self.iterator())
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/django/db/models/query.py" in iterator
  273.         for row in compiler.results_iter():
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in results_iter
  680.         for rows in self.execute_sql(MULTI):
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
  735.         cursor.execute(sql, params)
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/django/db/backends/util.py" in execute
  34.             return self.cursor.execute(sql, params)
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py" in execute
  86.             return self.cursor.execute(query, args)
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/MySQLdb/cursors.py" in execute
  174.             self.errorhandler(self, exc, value)
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/MySQLdb/connections.py" in defaulterrorhandler
  36.     raise errorclass, errorvalue

Exception Type: DatabaseError at /accounts/signup/
Exception Value: (1146, "Table 'demo_project.auth_user' doesn't exist")

edit

Sorry I couldn't update this question earlier, i was so busy, when I run syncdb, i see this error

Environment:


Request Method: POST
Request URL: http://127.0.0.1:8000/accounts/signup/

Django Version: 1.3.1
Python Version: 2.7.2
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.admin',
 'easy_thumbnails',
 'guardian',
 'south',
 'userena',
 'userena.contrib.umessages',
 'demo_project.profiles']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'userena.middleware.UserenaLocaleMiddleware')


Traceback:
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/userena/decorators.py" in _wrapped_view
  28.         return view_func(request, *args, **kwargs)
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/userena/views.py" in signup
  70.             user = form.save()
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/userena/forms.py" in save
  86.                                                      userena_settings.USERENA_ACTIVATION_REQUIRED)
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/userena/managers.py" in create_user
  62.         userena_profile = self.create_userena_profile(new_user)
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/userena/managers.py" in create_userena_profile
  104.                            activation_key=activation_key)
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/django/db/models/manager.py" in create
  138.         return self.get_query_set().create(**kwargs)
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/django/db/models/query.py" in create
  360.         obj.save(force_insert=True, using=self.db)
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/django/db/models/base.py" in save
  460.         self.save_base(using=using, force_insert=force_insert, force_update=force_update)
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/django/db/models/base.py" in save_base
  553.                     result = manager._insert(values, return_id=update_pk, using=using)
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/django/db/models/manager.py" in _insert
  195.         return insert_query(self.model, values, **kwargs)
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/django/db/models/query.py" in insert_query
  1436.     return query.get_compiler(using=using).execute_sql(return_id)
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
  791.         cursor = super(SQLInsertCompiler, self).execute_sql(None)
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
  735.         cursor.execute(sql, params)
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/django/db/backends/util.py" in execute
  34.             return self.cursor.execute(sql, params)
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py" in execute
  86.             return self.cursor.execute(query, args)
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/MySQLdb/cursors.py" in execute
  174.             self.errorhandler(self, exc, value)
File "/home/elie/.django-projects/showpill/local/lib/python2.7/site-packages/MySQLdb/connections.py" in defaulterrorhandler
  36.     raise errorclass, errorvalue

Exception Type: DatabaseError at /accounts/signup/
Exception Value: (1146, "Table 'demo_project.userena_userenasignup' doesn't exist")

2nd EDIT

this is the output of syncdb

Syncing...
Creating tables ...
Installing custom SQL ...
Installing indexes ...
No fixtures found.

Synced:
 > django.contrib.auth
 > django.contrib.contenttypes
 > django.contrib.sessions
 > django.contrib.sites
 > django.contrib.messages
 > django.contrib.admin
 > south
 > demo_project.profiles

Not synced (use migrations):
 - easy_thumbnails
 - guardian
 - userena
 - userena.contrib.umessages
(use ./manage.py migrate to migrate these)

This is the output of ./manage.py migrate

Running migrations for easy_thumbnails:
- Nothing to migrate.
 - Loading initial data for easy_thumbnails.
No fixtures found.
Running migrations for guardian:
- Nothing to migrate.
 - Loading initial data for guardian.
No fixtures found.
Running migrations for userena:
- Nothing to migrate.
 - Loading initial data for userena.
No fixtures found.
Running migrations for umessages:
- Nothing to migrate.
 - Loading initial data for umessages.
No fixtures found.

please note that eventhough i am seeing the error, the username and email are being saved in the db.

if I login, it says your account has been disabled

if i try to reset my password it says

That e-mail address doesn't have an associated user account. Are you sure you've registered?

user
  • 973
  • 4
  • 14
  • 29
  • @Mat sorry sir, you are right, i just thought that the error is big, so i tried to keep the question as short as possible but you are right, I'll do that from now on – user Mar 06 '12 at 10:54

2 Answers2

5

You need to run syncdb: manage.py syncdb

You've worked out that you need to also use the various south commands.

Now two questions arise: are you still getting these errors after running south (I assume you are); and secondly, does the table specified in the error message (Exception Value: (1146, "Table 'demo_project.userena_userenasignup' doesn't exist")) actually exist? Examine your database to work out if the table exists, and if so, if it exists in the right database.

Marcin
  • 48,559
  • 18
  • 128
  • 201
3

I think you need to delete your database. Then do a manage.py syncdb and a manage.py migrate again on a fresh DB. When you run manage.py migrate it shouldn't give you the output you posted. Your output doesn't change or create any tables and that could be the issue. Perhaps the table you need hasn't been created.

  1. This is what the output should look like after a manage.py syncdb.
  2. This is what the output should look like after a manage.py migrate.

You should have 21 tables in total for the demo_project provided with userena.


For general help the steps to get this project working should be.

  1. Create a virtual environment and pip install django-userena
  2. Pull out the demo_project that comes with userena
  3. Activate the virtualenv, cd to the project dir and do your manage.py syncdb and manage.py migrate
  4. Run the project

I have done this now and can confirm that the demo_project will work if these steps are done.

*Remember that if you signup a user on the /accounts/signup/ page. That this user will not be able to signin to the /admin/ by default. And your superuser user will not be able to access his profile under /accounts/(profile)/ unless you give him a profile in the admin.

darren
  • 18,845
  • 17
  • 60
  • 79
  • so seeing [this](http://pastebin.com/KjJBgrb9) error is normal? – user Mar 09 '12 at 00:46
  • No that is not normal. You should have no errors at all. When does that error happen. Does it happen when you try to signup a new user? – darren Mar 09 '12 at 08:09
  • yep after sign up, the output of `syncdb` and `migrate` is exaclty as you described – user Mar 09 '12 at 10:20
  • I think the error is the email. When you signup you will receive an activation email. I believe that your email is giving an error. Make sure to setup your email settings and the email should send fine and hopefully take care of your error. Look here for help in setting up email: https://docs.djangoproject.com/en/dev/topics/email/ Also remember to change your site under sites in your admin. Change it to 127.0.0.1:8000 instead of the example.com – darren Mar 09 '12 at 10:34
  • i should setup the mail settings? I thought that the demo has everything set up already :) – user Mar 09 '12 at 10:56
  • It does, except the emails need to be sent somehow so it needs your smtp setting to finish the signup process. Or you can create a profile manually in the admin and manually activate the linked user but I wouldn't advise it. If you don't have an SMTP you can use gmail to send email. Look here: http://stackoverflow.com/questions/6914687/django-sending-email/6915291#6915291 good luck and hope this fixes your issues. Please tick answer if it has answered your question. – darren Mar 09 '12 at 11:26
  • would you please answer [this question](http://stackoverflow.com/questions/9832037/editing-django-userena) sir? you are the master of django-userena :) – user Mar 22 '12 at 23:26
  • unknown command: 'syncdb' , please correct your answer – LKM May 29 '16 at 14:01
  • 1
    syncdb is deprecated by migrate, please answer with knowledge – LKM May 29 '16 at 14:03