I am having trouble getting my model to work with the admin interface. I created a similar web app with the same settings as that of the pythonanywhere web app on a standalone machine and it worked. I need help..
I am having trouble getting my model to work with the admin interface. I created a similar web app with the same settings as that of the pythonanywhere web app on a standalone machine and it worked. I need help..
Specifically what is happening that shouldn't or what's not happening that should? If you have stacktraces or error messages, post them so we can work out what's going on.
The database settings are because I was able to access the model class thru the shell command. I have tried different combination for naming the webapp such 'sda' and 'meadowvale.sda' and still does not work but if I comment/remove the web app from the setting file it works but not including the models i defined.
settings.py
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
'sda',
'songs',
)
Here is the stacktrace
2013-03-18 00:10:48,921 :Traceback (most recent call last):
2013-03-18 00:10:48,922 : File "/usr/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 272, in __call__
2013-03-18 00:10:48,922 : response = self.get_response(request)
2013-03-18 00:10:48,922 : File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 169, in get_response
2013-03-18 00:10:48,922 : response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
2013-03-18 00:10:48,923 : File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 203, in handle_uncaught_exception
2013-03-18 00:10:48,923 : return debug.technical_500_response(request, *exc_info)
2013-03-18 00:10:48,923 : File "/usr/local/lib/python2.7/site-packages/django/views/debug.py", line 59, in technical_500_response
2013-03-18 00:10:48,934 : html = reporter.get_traceback_html()
2013-03-18 00:10:48,934 : File "/usr/local/lib/python2.7/site-packages/django/views/debug.py", line 151, in get_traceback_html
2013-03-18 00:10:48,935 : return t.render(c)
2013-03-18 00:10:48,935 : File "/usr/local/lib/python2.7/site-packages/django/template/base.py", line 123, in render
2013-03-18 00:10:48,936 : return self._render(context)
2013-03-18 00:10:48,936 : File "/usr/local/lib/python2.7/site-packages/django/template/base.py", line 117, in _render
2013-03-18 00:10:48,936 : return self.nodelist.render(context)
2013-03-18 00:10:48,936 : File "/usr/local/lib/python2.7/site-packages/django/template/base.py", line 744, in render
2013-03-18 00:10:48,937 : bits.append(self.render_node(node, context))
2013-03-18 00:10:48,937 : File "/usr/local/lib/python2.7/site-packages/django/template/debug.py", line 73, in render_node
2013-03-18 00:10:48,937 : result = node.render(context)
2013-03-18 00:10:48,937 : File "/usr/local/lib/python2.7/site-packages/django/template/debug.py", line 90, in render
2013-03-18 00:10:48,938 : output = self.filter_expression.resolve(context)
2013-03-18 00:10:48,938 : File "/usr/local/lib/python2.7/site-packages/django/template/base.py", line 536, in resolve
2013-03-18 00:10:48,938 : new_obj = func(obj, *arg_vals)
2013-03-18 00:10:48,938 : File "/usr/local/lib/python2.7/site-packages/django/template/defaultfilters.py", line 695, in date
2013-03-18 00:10:48,939 : return format(value, arg)
2013-03-18 00:10:48,939 : File "/usr/local/lib/python2.7/site-packages/django/utils/dateformat.py", line 285, in format
2013-03-18 00:10:48,948 : return df.format(format_string)
2013-03-18 00:10:48,948 : File "/usr/local/lib/python2.7/site-packages/django/utils/dateformat.py", line 30, in format
2013-03-18 00:10:48,948 : pieces.append(force_unicode(getattr(self, piece)()))
2013-03-18 00:10:48,948 : File "/usr/local/lib/python2.7/site-packages/django/utils/dateformat.py", line 191, in r
2013-03-18 00:10:48,949 : return self.format('D, j M Y H:i:s O')
2013-03-18 00:10:48,949 : File "/usr/local/lib/python2.7/site-packages/django/utils/dateformat.py", line 30, in format
2013-03-18 00:10:48,949 : pieces.append(force_unicode(getattr(self, piece)()))
2013-03-18 00:10:48,949 : File "/usr/local/lib/python2.7/site-packages/django/utils/encoding.py", line 71, in force_unicode
2013-03-18 00:10:48,949 : s = unicode(s)
2013-03-18 00:10:48,950 : File "/usr/local/lib/python2.7/site-packages/django/utils/functional.py", line 206, in __unicode_cast
2013-03-18 00:10:48,950 : return self.__func(*self.__args, **self.__kw)
2013-03-18 00:10:48,950 : File "/usr/local/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 81, in ugettext
2013-03-18 00:10:48,957 : return _trans.ugettext(message)
2013-03-18 00:10:48,957 : File "/usr/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 286, in ugettext
2013-03-18 00:10:48,967 : return do_translate(message, 'ugettext')
2013-03-18 00:10:48,967 : File "/usr/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 276, in do_translate
2013-03-18 00:10:48,967 : _default = translation(settings.LANGUAGE_CODE)
2013-03-18 00:10:48,967 : File "/usr/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 185, in translation
2013-03-18 00:10:48,967 : default_translation = _fetch(settings.LANGUAGE_CODE)
2013-03-18 00:10:48,968 : File "/usr/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 162, in _fetch
2013-03-18 00:10:48,968 : app = import_module(appname)
2013-03-18 00:10:48,968 : File "/usr/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
2013-03-18 00:10:48,968 : __import__(name)
2013-03-18 00:10:48,968 :django.template.base.TemplateSyntaxError: Caught ImportError while rendering: No module named songs
2013-03-18 00:10:49,261 :Traceback (most recent call last):
2013-03-18 00:10:49,261 : File "/usr/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 272, in __call__
2013-03-18 00:10:49,262 : response = self.get_response(request)
2013-03-18 00:10:49,262 : File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 169, in get_response
2013-03-18 00:10:49,262 : response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
2013-03-18 00:10:49,262 : File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 203, in handle_uncaught_exception
2013-03-18 00:10:49,262 : return debug.technical_500_response(request, *exc_info)
2013-03-18 00:10:49,262 : File "/usr/local/lib/python2.7/site-packages/django/views/debug.py", line 59, in technical_500_response
2013-03-18 00:10:49,263 : html = reporter.get_traceback_html()
2013-03-18 00:10:49,263 : File "/usr/local/lib/python2.7/site-packages/django/views/debug.py", line 151, in get_traceback_html
2013-03-18 00:10:49,263 : return t.render(c)
2013-03-18 00:10:49,263 : File "/usr/local/lib/python2.7/site-packages/django/template/base.py", line 123, in render
2013-03-18 00:10:49,263 : return self._render(context)
2013-03-18 00:10:49,263 : File "/usr/local/lib/python2.7/site-packages/django/template/base.py", line 117, in _render
2013-03-18 00:10:49,263 : return self.nodelist.render(context)
2013-03-18 00:10:49,263 : File "/usr/local/lib/python2.7/site-packages/django/template/base.py", line 744, in render
2013-03-18 00:10:49,264 : bits.append(self.render_node(node, context))
2013-03-18 00:10:49,264 : File "/usr/local/lib/python2.7/site-packages/django/template/debug.py", line 73, in render_node
2013-03-18 00:10:49,264 : result = node.render(context)
2013-03-18 00:10:49,264 : File "/usr/local/lib/python2.7/site-packages/django/template/debug.py", line 90, in render
2013-03-18 00:10:49,264 : output = self.filter_expression.resolve(context)
2013-03-18 00:10:49,264 : File "/usr/local/lib/python2.7/site-packages/django/template/base.py", line 536, in resolve
2013-03-18 00:10:49,265 : new_obj = func(obj, *arg_vals)
2013-03-18 00:10:49,265 : File "/usr/local/lib/python2.7/site-packages/django/template/defaultfilters.py", line 695, in date
2013-03-18 00:10:49,265 : return format(value, arg)
2013-03-18 00:10:49,265 : File "/usr/local/lib/python2.7/site-packages/django/utils/dateformat.py", line 285, in format
2013-03-18 00:10:49,265 : return df.format(format_string)
2013-03-18 00:10:49,266 : File "/usr/local/lib/python2.7/site-packages/django/utils/dateformat.py", line 30, in format
2013-03-18 00:10:49,266 : pieces.append(force_unicode(getattr(self, piece)()))
2013-03-18 00:10:49,266 : File "/usr/local/lib/python2.7/site-packages/django/utils/dateformat.py", line 191, in r
2013-03-18 00:10:49,266 : return self.format('D, j M Y H:i:s O')
2013-03-18 00:10:49,266 : File "/usr/local/lib/python2.7/site-packages/django/utils/dateformat.py", line 30, in format
2013-03-18 00:10:49,266 : pieces.append(force_unicode(getattr(self, piece)()))
2013-03-18 00:10:49,266 : File "/usr/local/lib/python2.7/site-packages/django/utils/encoding.py", line 71, in force_unicode
2013-03-18 00:10:49,266 : s = unicode(s)
2013-03-18 00:10:49,267 : File "/usr/local/lib/python2.7/site-packages/django/utils/functional.py", line 206, in __unicode_cast
2013-03-18 00:10:49,267 : return self.__func(*self.__args, **self.__kw)
2013-03-18 00:10:49,267 : File "/usr/local/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 81, in ugettext
2013-03-18 00:10:49,267 : return _trans.ugettext(message)
2013-03-18 00:10:49,267 : File "/usr/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 286, in ugettext
2013-03-18 00:10:49,267 : return do_translate(message, 'ugettext')
2013-03-18 00:10:49,267 : File "/usr/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 276, in do_translate
2013-03-18 00:10:49,268 : _default = translation(settings.LANGUAGE_CODE)
2013-03-18 00:10:49,268 : File "/usr/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 185, in translation
2013-03-18 00:10:49,268 : default_translation = _fetch(settings.LANGUAGE_CODE)
2013-03-18 00:10:49,268 : File "/usr/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 162, in _fetch
2013-03-18 00:10:49,268 : app = import_module(appname)
2013-03-18 00:10:49,268 : File "/usr/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
2013-03-18 00:10:49,268 : __import__(name)
2013-03-18 00:10:49,269 :django.template.base.TemplateSyntaxError: Caught ImportError while rendering: No module named songs
2013-03-18 18:50:37,850 :Traceback (most recent call last):
2013-03-18 18:50:37,850 : File "/usr/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 272, in __call__
2013-03-18 18:50:37,851 : response = self.get_response(request)
2013-03-18 18:50:37,851 : File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 169, in get_response
2013-03-18 18:50:37,851 : response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
2013-03-18 18:50:37,851 : File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 203, in handle_uncaught_exception
2013-03-18 18:50:37,851 : return debug.technical_500_response(request, *exc_info)
2013-03-18 18:50:37,852 : File "/usr/local/lib/python2.7/site-packages/django/views/debug.py", line 59, in technical_500_response
2013-03-18 18:50:37,878 : html = reporter.get_traceback_html()
2013-03-18 18:50:37,878 : File "/usr/local/lib/python2.7/site-packages/django/views/debug.py", line 151, in get_traceback_html
2013-03-18 18:50:37,879 : return t.render(c)
2013-03-18 18:50:37,879 : File "/usr/local/lib/python2.7/site-packages/django/template/base.py", line 123, in render
2013-03-18 18:50:37,880 : return self._render(context)
2013-03-18 18:50:37,880 : File "/usr/local/lib/python2.7/site-packages/django/template/base.py", line 117, in _render
2013-03-18 18:50:37,880 : return self.nodelist.render(context)
2013-03-18 18:50:37,880 : File "/usr/local/lib/python2.7/site-packages/django/template/base.py", line 744, in render
2013-03-18 18:50:37,881 : bits.append(self.render_node(node, context))
2013-03-18 18:50:37,881 : File "/usr/local/lib/python2.7/site-packages/django/template/debug.py", line 73, in render_node
2013-03-18 18:50:37,881 : result = node.render(context)
2013-03-18 18:50:37,881 : File "/usr/local/lib/python2.7/site-packages/django/template/debug.py", line 90, in render
2013-03-18 18:50:37,882 : output = self.filter_expression.resolve(context)
2013-03-18 18:50:37,882 : File "/usr/local/lib/python2.7/site-packages/django/template/base.py", line 536, in resolve
2013-03-18 18:50:37,882 : new_obj = func(obj, *arg_vals)
2013-03-18 18:50:37,882 : File "/usr/local/lib/python2.7/site-packages/django/template/defaultfilters.py", line 695, in date
2013-03-18 18:50:37,883 : return format(value, arg)
2013-03-18 18:50:37,883 : File "/usr/local/lib/python2.7/site-packages/django/utils/dateformat.py", line 285, in format
2013-03-18 18:50:37,884 : return df.format(format_string)
2013-03-18 18:50:37,884 : File "/usr/local/lib/python2.7/site-packages/django/utils/dateformat.py", line 30, in format
2013-03-18 18:50:37,884 : pieces.append(force_unicode(getattr(self, piece)()))
2013-03-18 18:50:37,885 : File "/usr/local/lib/python2.7/site-packages/django/utils/dateformat.py", line 191, in r
2013-03-18 18:50:37,885 : return self.format('D, j M Y H:i:s O')
2013-03-18 18:50:37,885 : File "/usr/local/lib/python2.7/site-packages/django/utils/dateformat.py", line 30, in format
2013-03-18 18:50:37,885 : pieces.append(force_unicode(getattr(self, piece)()))
2013-03-18 18:50:37,885 : File "/usr/local/lib/python2.7/site-packages/django/utils/encoding.py", line 71, in force_unicode
2013-03-18 18:50:37,886 : s = unicode(s)
2013-03-18 18:50:37,886 : File "/usr/local/lib/python2.7/site-packages/django/utils/functional.py", line 206, in __unicode_cast
2013-03-18 18:50:37,886 : return self.__func(*self.__args, **self.__kw)
2013-03-18 18:50:37,886 : File "/usr/local/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 81, in ugettext
2013-03-18 18:50:37,887 : return _trans.ugettext(message)
2013-03-18 18:50:37,887 : File "/usr/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 286, in ugettext
2013-03-18 18:50:37,902 : return do_translate(message, 'ugettext')
2013-03-18 18:50:37,903 : File "/usr/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 276, in do_translate
2013-03-18 18:50:37,903 : _default = translation(settings.LANGUAGE_CODE)
2013-03-18 18:50:37,903 : File "/usr/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 185, in translation
2013-03-18 18:50:37,903 : default_translation = _fetch(settings.LANGUAGE_CODE)
2013-03-18 18:50:37,903 : File "/usr/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 162, in _fetch
2013-03-18 18:50:37,903 : app = import_module(appname)
2013-03-18 18:50:37,903 : File "/usr/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
2013-03-18 18:50:37,904 : __import__(name)
2013-03-18 18:50:37,904 :django.template.base.TemplateSyntaxError: Caught ImportError while rendering: No module named songs
[Post edited by admin for readability]
For reference there are actually seven separate tracebacks there, it would be useful if you could trim your post down to contain just one of them. Also, if you indent each line by four spaces it'll present it as a preformatted block, which will greatly aid readability.
As it happens it looks like your code is failing to import a songs
module which looks like it's used in some template code - is this one you've written yourself? My guess is that sys.path
is missing some entries in your environment on PA where you've added them when testing elsewhere, perhaps in the webserver configuration.
Thanks I got it to work I realized that I was using the import statement incorrect inside the admin.py file and the import statement should read like this project_name.appname (mysite.sda) in which I had import sda. However I understand now since I was so accustoms to using the 1.4XX version of django which only allows you to make reference to the appname throughout the entire project setting file and etc..
My question is the PA team planning to upgrade to 1.4 for django?
Thanks
I'm not sure if or when the system version of Django will be upgraded - it's a tricky one because there are likely to be a number of people who can't or don't wish to upgrade yet.
However, it's quite possible to build your own virtualenv and run Django 1.4 inside it - there's a complete tutorial on how to do it, in fact. You might also like to look at this thread which is an older discussion of how to get it working - you can also search the forums for "Django 1.4"
to find more threads about issues people have had and the solutions to them.
@Cartroo -- exactly right as usual :-) Harry's been working on a virtualenvify script that people will be able to run to put their existing Django 1.3 apps in virtualenvs and protect them against future system version upgrades; we're also thinking about how we can make using virtualenvs more of a default thing so that we don't run into this kind of problem in the future.
Hm, yes, if the web shortcuts to set up the different web apps created virtualenvs by default that could work fairly well. The trick would be not confusing people who don't know about virtualenv, I suppose.
Precisely. Perhaps we'd need to have the concept of starting a console in the context of a specific web app. Though then that could get confusing if you cd
ed into the directory of another...
Hello, I have the same error, I can see you have solved the problem, but from what is written here I cannot understand what to change and where. This whole thread seems to be completely useless for anybody who wants to fix the same error.
The last post by MOC contains the solution. If it doesn't apply to you the post appropriate code and tracebacks and we'll see what we can work out.
@giles: I'm not opposed to the idea for the average user. However, when they decide to upgrade to a future version how will they do it? Will they be provided upgrade buttons for these venvs that get created? What if they skip more than one prior to upgrading?
Hmm, not quite sure that I understand you there... I was thinking that a web app could be associated with a virtualenv, so we'd just do a "workon XXXX" when starting the console. If someone wanted to upgrade a specific module inside a virtualenv, they could start a console and then just pip install in there. Does that make sense?
@giles: Sorry, I was in a hurry when I wrote my question and I knew it was confusing...ha
Okay, I'll try and take my time now!
If PA provides a button to create a web-app for UserX in a venv. Great. Now PA won't break anything for UserX when the shared Django is updated. Let's now look at a couple of thoughts on this setup.
Scenario: Shared Django gets upgraded to next version.
Scenario: I sure wish I could remember the other thoughts I had on this.
I'll just leave it there for now. I need to take more Ginko or something.
Right, got it. You're entirely right, making things easy to start in virtualenvs and then essentially abandoning people to maintain them themselves would possibly be a Bad Thing. But not abandoning them and providing "upgrade my virtualenv" buttons would make the auto-virtualenv task much larger.
Hmm. More thought needed.
@giles: I'm glad I eventually made enough sense for you to translate. You stated that so much better than me...thx!!