Closed nknj closed 9 years ago
This line:
django.contrib.admin import ModelAdmin, actions;
Doesn't appear anywhere within longerusername. The only guess I've got is that apache's mod_wsgi is doing some weird caching of pycs and doesn't accept the monkeypatch.
Given that this isn't on fire for anyone else, I'd honestly say your best bets to get this fixed are:
Apologies for not having a better answer, but I've found it's better to be honest with folks about how much time I've got to split between open source projects, and their best avenues for a fix.
Best of luck, and feel free to throw comments on here as you debug / find a solution!
Thanks skoczen. I am pretty new to all this but if i manage to find a fix I will send in a pull request.
I had a similar problem, and commenting the field.help_text
line in models.py
fixed it.
@joaolsilva I experienced the same problem and fixed it with what you suggested. @skoczen any idea about why this is happening and how to fix it?
@neilp9 sorry, nope. Everything I know is in the comment above. If you've got a fix though, send a pull!
OK @skoczen. Just for reference, here's my stack trace:
File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 143, in filter
return self.get_query_set().filter(_args, _kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 624, in filter
return self._filter_or_exclude(False, _args, _kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 642, in _filter_or_exclude
clone.query.add_q(Q(_args, *_kwargs))
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/query.py", line 1250, in add_q
can_reuse=used_aliases, force_having=force_having)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/query.py", line 1122, in add_filter
process_extras=process_extras)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/query.py", line 1304, in setup_joins
field, model, direct, m2m = opts.get_field_by_name(name)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/options.py", line 311, in get_field_by_name
cache = self.init_name_map()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/options.py", line 341, in init_name_map
for f, model in self.get_all_related_m2m_objects_with_model():
File "/usr/local/lib/python2.7/dist-packages/django/db/models/options.py", line 429, in get_all_related_m2m_objects_with_model
cache = self._fill_related_many_to_many_cache()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/options.py", line 443, in _fill_related_many_to_many_cache
for klass in get_models(only_installed=False):
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 181, in get_models
self._populate()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 64, in _populate
self.load_app(app_name, True)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 86, in load_app
app_module = import_module(app_name)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
import(name)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/init.py", line 6, in
Got the same error and fixed by commenting the help text line.
Just to confirm, same issue on gunicorn 18 and 19 and nginx, using django_gunicorn deployment which is deprecated. I will be switching to wsgi and see if the problem persists, but yes commeting out help_text does do the trick. I found this to be somewhat informative on the issue, and it does note that its a deployment issue: http://askbot.org/en/question/9594/why-askbot-works-with-runserver-but-fails-with-production-server/
To further confirm, I still run into this issue using gunicorn but only if I run it as a service from /etc/init/service.conf , from the command line it runs fine.
By using lazy ugetttext (from django.utils.translation import ugettextlazy as ) instead in models.py seems to fix the problem.
Its odd that it runs under certain deployment routes and not others. (runserver OK, gunicorn in command line OK, gunicorn as a service FAIL)
Closing this up, since the supported solution is to use the more maintained fork https://github.com/madssj/django-longer-username-and-email, or Django 1.5+'s custom user models.
Thanks! -Steven
I just experienced the same problem as http://django-irc-logs.com/2012/sep/30/#747079
This happens only on apache with mod_wsgi. Every second or third time I refresh the page, I get a 500 error: from django.contrib.admin import ModelAdmin, actions; ImportError: cannot import name actions;
This problem disappears when I remove longerusername from my installed apps.