First time here? Check out the FAQ!

kecebongsoft's profile - activity

2017-01-28 12:23:03 -0500 received badge Notable Question (source)
2014-10-14 09:26:39 -0500 received badge Notable Question (source)
2014-07-28 09:41:22 -0500 received badge Popular Question (source)
2013-08-09 15:46:12 -0500 received badge Popular Question (source)
2013-02-23 07:04:32 -0500 received badge Famous Question (source)
2013-01-09 05:33:35 -0500 received badge Famous Question (source)
2012-12-26 09:12:07 -0500 commented question Askbot fails when using Nginx+Gunicorn

I use django.contrib.auth.models, the reason I use that example is because that particular code is also exist in Askbot template.

2012-12-26 08:40:20 -0500 commented question Askbot fails when using Nginx+Gunicorn

@Evgeny I triggered migrations many times before and checked my migration list, it was all completed, I added more details in the question. Thanks!.

2012-12-23 08:11:32 -0500 asked a question Askbot fails when using Nginx+Gunicorn

In my attempt to integrate Askbot with an already running Django site, I had to make it run under current setup (nginx+gunicorn), but it keeps failing, been trying to figure out what's wrong but now I'm pretty much clueless. There are some speculation about the python paths, gunicorn workers (gevent) and other stuff, but even after trying to change all of them, it still failed. The error was:

'NoneType' object has no attribute 'field_name'

Here's the complete stack trace: https://gist.github.com/4363587

This is not happening when I'm running the dev server (manage.py runserver).

Appreciate any help and thanks for making such an awesome Q&A Platform!.

Update This seems to be triggered by Group model, a simple query would break the script with the same error:

from askbot.models.user import Group
Group.objects.filter(user=[any_user])

The same code would run just fine from ./manage.py shell

Update This error is somehow related to fetching ManyToMany relationship. To trigger it, try running this on dev and gunicorn:

user = User.objects.get(username='admin') # for example
user.get_primary_group()

When running that code on dev, I get fine result, however gunicorn shows:

'NoneType' object has no attribute 'field_name'

If you follow the stack trace, you'll get to this function to map m2m attribute in Django, I tried to inject this to compare the result of f.rel.to == related.model for get_primary_group(), here's what I get with dev server:

<django.contrib.auth.models.User> == <django.contrib.auth.models.User>

And here's what I get with gunicorn:

<django.contrib.auth.models.User> != <django.contrib.auth.models.User>

If I use dir() on both scenarios, it turned out that the User model on dev server has a lot of properties and map the complete list of related_name (my apps and askbot), in gunicorn, there is just default User properties such as change_password.

You can also try to run this code in both dev and gunicorn, the result on both server will be different:

from django.contrib.auth.models import User
print dir(User.groups.field.rel.through._meta.fields[1].rel.to) # Will return User model

But strangely, this code shows fine and same result on both server:

from django.contrib.auth.models import User
print dir(User)

First I thought it was a migration problem, but I already triggered migration many times and checked my migration list, it was completed.

2012-12-07 06:25:59 -0500 received badge Self-Learner ( source )
2012-12-07 06:25:59 -0500 received badge Teacher ( source )
2012-12-07 06:25:46 -0500 received badge Student (source)
2012-12-07 01:06:15 -0500 received badge Editor ( source )
2012-12-07 01:06:01 -0500 answered a question 'Thread matching query does not exist' when posting question.

Nevermind, after hours of trying, I figured out that it needs to run in celery 2.2.7. Case closed.

2012-12-06 10:25:19 -0500 asked a question 'Thread matching query does not exist' when posting question.

I'm trying to integrate Askbot as a part of a larger site. I forked the repo (askbot-devel) to modify some tests to suit my settings, after performing a syncdb and migrate command, everything went fine, except that I can't post a question. When I submit a question, it's showing Thread does not exists.

Here is the error log:

Environment:
Request Method: POST
Request URL: http://localhost:8000/question/questions/ask/

Django Version: 1.3.1
Python Version: 2.7.3
Installed Applications:
['longerusername',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'grappelli',
'django.contrib.admin',
'django.contrib.sitemaps',
'group_messaging',
'askbot',
'askbot.deps.django_authopenid',
'askbot.deps.livesettings',
'south',
'compressor',
'tinymce',
'captcha',
'social_auth',
'taggit',
'mptt',
'easy_thumbnails',
'widget_tweaks',
'jquery_widgets',
'django_open_inviter',
'django_extensions',
'djcelery',
'djkombu',
'seacucumber',
'faq',
'django_tables2',
'haystack',
'raven.contrib.django',
'references',
'qualifications',
'accounts',
'articles',
'institutions',
'vocations',
'students',
'shortlists',
'educations',
'partners',
'partners.agents',
'applications',
'reviews',
'hescar_utils',
'pstest',
'inquiries',
'staticpages',
'medias',
'emails',
'external',
'caches',
'targeted_ads',
'treasurehunt',
'subscribers',
'backend',
'backend.assigns',
'backend.streams',
'backend.labels',
'backend.kivs',
'backend.tasks',
'backend.appointments',
'backend.reminders',
'appback.users',
'appback.core',
'appback.notes',
'appback.appointments_old',
'appback.references',
'appback.students',
'appback.reminders',
'appback.coldcalls',
'debug_toolbar']
Installed Middleware:
('django.middleware.cache.UpdateCacheMiddleware',
'johnny.middleware.LocalStoreClearMiddleware',
'johnny.middleware.QueryCacheMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'hescar_utils.middleware.LocalizationURLMiddleware',
'backend.middleware.LanguageForcingMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'askbot.middleware.anon_user.ConnectToSessionMessagesMiddleware',
'askbot.middleware.forum_mode.ForumModeMiddleware',
'askbot.middleware.cancel.CancelActionMiddleware',
'django.middleware.transaction.TransactionMiddleware',
'askbot.middleware.view_log.ViewLogMiddleware',
'askbot.middleware.spaceless.SpacelessMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'hescar_utils.middleware.SpacelessMiddleware',
'hescar_utils.middleware.ThreadLocals',
'hescar_utils.middleware.DFPMiddleware',
'hescar_utils.middleware.LoginMiddleware',
'hescar_utils.middleware.PasswordRequiredMiddleware',
'hescar_utils.middleware.PageVisitCounterMiddleware',
'hescar_utils.middleware.MBAMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware')


Traceback:
File "/home/kecebongsoft/workspaces/easyuni/easyuni-env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
117.                             response = middleware_method(request, e)
File "/home/kecebongsoft/workspaces/easyuni/easyuni-env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/home/kecebongsoft/workspaces/easyuni/easyuni-env/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
93.                     response = view_func(request, *args, **kwargs)
File "/home/kecebongsoft/workspaces/easyuni/easyuni-env/src/askbot/askbot/utils/decorators.py" in wrapper
135.             return view_func(request, *args, **kwargs)
File "/home/kecebongsoft/workspaces/easyuni/easyuni-env/src/askbot/askbot/utils/decorators.py" in wrapper
230.             return view_func(request, *args, **kwargs)
File "/home/kecebongsoft/workspaces/easyuni/easyuni-env/src/askbot/askbot/views/writers.py" in ask
244.                     return HttpResponseRedirect(question.get_absolute_url())
File "/home/kecebongsoft/workspaces/easyuni/easyuni-env/local/lib/python2.7/site-packages/django/utils/functional.py" in _curried
55.         return _curried_func(*(args+moreargs), **dict(kwargs, **morekwargs))
File "/home/kecebongsoft/workspaces/easyuni/easyuni-env/local/lib/python2.7/site-packages/django/db/models/base.py" in get_absolute_url
887.     return settings.ABSOLUTE_URL_OVERRIDES.get('%s.%s' % (opts.app_label, opts.module_name), func)(self, *args, **kwargs)
File "/home/kecebongsoft/workspaces/easyuni/easyuni-env/src/askbot/askbot/models/post.py" in get_absolute_url
758.                 url += django_urlquote(self ...
(more)