Django-CMS javascript 500 errors

烂漫一生 提交于 2020-01-07 01:52:25

问题


I'm getting three 500 errors when I try to edit a page with django-cms in the admin panel. Here's the error report.

Traceback (most recent call last):

 File "/home/[redacted]/webapps/django/lib/python2.6/django/core/handlers/base.py", line 111, in get_response
   response = callback(request, *callback_args, **callback_kwargs)

 File "/home/[redacted]/webapps/django/lib/python2.6/django/contrib/admin/options.py", line 307, in wrapper
   return self.admin_site.admin_view(view)(*args, **kwargs)

 File "/home/[redacted]/webapps/django/lib/python2.6/django/utils/decorators.py", line 93, in _wrapped_view
   response = view_func(request, *args, **kwargs)

 File "/home/[redacted]/webapps/django/lib/python2.6/django/views/decorators/cache.py", line 79, in _wrapped_view_func
   response = view_func(request, *args, **kwargs)

 File "/home/[redacted]/webapps/django/lib/python2.6/django/contrib/admin/sites.py", line 197, in inner
   return view(request, *args, **kwargs)

 File "/home/[redacted]/lib/python2.6/django_cms-2.1.4-py2.6.egg/cms/admin/pageadmin.py", line 510, in change_view
   obj = self.model.objects.get(pk=object_id)

 File "/home/[redacted]/webapps/django/lib/python2.6/django/db/models/manager.py", line 132, in get
   return self.get_query_set().get(*args, **kwargs)

 File "/home/[redacted]/webapps/django/lib/python2.6/django/db/models/query.py", line 341, in get
   clone = self.filter(*args, **kwargs)

 File "/home/[redacted]/webapps/django/lib/python2.6/django/db/models/query.py", line 550, in filter
   return self._filter_or_exclude(False, *args, **kwargs)

 File "/home/[redacted]/webapps/django/lib/python2.6/django/db/models/query.py", line 568, in _filter_or_exclude
   clone.query.add_q(Q(*args, **kwargs))

 File "/home/[redacted]/webapps/django/lib/python2.6/django/db/models/sql/query.py", line 1172, in add_q
   can_reuse=used_aliases, force_having=force_having)

 File "/home/[redacted]/webapps/django/lib/python2.6/django/db/models/sql/query.py", line 1107, in add_filter
   connector)

 File "/home/[redacted]/webapps/django/lib/python2.6/django/db/models/sql/where.py", line 67, in add
   value = obj.prepare(lookup_type, value)

 File "/home/[redacted]/webapps/django/lib/python2.6/django/db/models/sql/where.py", line 316, in prepare
   return self.field.get_prep_lookup(lookup_type, value)

 File "/home/[redacted]/webapps/django/lib/python2.6/django/db/models/fields/__init__.py", line 292, in get_prep_lookup
   return self.get_prep_value(value)

 File "/home/[redacted]/webapps/django/lib/python2.6/django/db/models/fields/__init__.py", line 479, in get_prep_value
   return int(value)

ValueError: invalid literal for int() with base 10: '1/js/csrf.js'


<WSGIRequest
GET:<QueryDict: {}>,
POST:<QueryDict: {}>,
COOKIES:{'__utma': '111342044.1345274159.1313043558.1315127566.1315169313.27',
 '__utmb': '111342044.3.10.1315169313',
 '__utmc': '111342044',
 '__utmz': '111342044.1315169313.27.13.utmcsr=localhost:3000|utmccn=(referral)|utmcmd=referral|utmcct=/admin/internships/internship/1688/',
 'csrftoken': '9a6c3368e5940fa54fa7664a1aa3c9fc',
 'sessionid': '2df04980665fde5885d8168bad897d23'},
META:{'CSRF_COOKIE': '9a6c3368e5940fa54fa7664a1aa3c9fc',
 'DOCUMENT_ROOT': '/usr/local/apache2/htdocs',
 'GATEWAY_INTERFACE': 'CGI/1.1',
 'HTTPS': '1',
 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
 'HTTP_ACCEPT_ENCODING': 'gzip,deflate,sdch',
 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.8',
 'HTTP_CONNECTION': 'close',
 'HTTP_COOKIE': '__utma=111342044.1345274159.1313043558.1315127566.1315169313.27; __utmb=111342044.3.10.1315169313; __utmc=111342044; __utmz=111342044.1315169313.27.13.utmcsr=localhost:3000|utmccn=(referral)|utmcmd=referral|utmcct=/admin/internships/internship/1688/; sessionid=[redacted]; csrftoken=[redacted]',
 'HTTP_HOST': '[redacted]',
 'HTTP_HTTPS': 'on',
 'HTTP_HTTP_X_FORWARDED_PROTO': 'https',
 'HTTP_USER_AGENT': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_6) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1',
 'HTTP_X_FORWARDED_FOR': '174.253.245.193',
 'HTTP_X_FORWARDED_HOST': '[redacted]',
 'HTTP_X_FORWARDED_PROTO': 'https',
 'HTTP_X_FORWARDED_SERVER': '[redacted]',
 'HTTP_X_FORWARDED_SSL': 'on',
 'PATH_INFO': u'/admin/cms/page/1/js/csrf.js/',
 'PATH_TRANSLATED': '/home/[redacted]/webapps/django/[redacted].wsgi/admin/cms/page/1/js/csrf.js/',
 'QUERY_STRING': '',
 'REMOTE_ADDR': '127.0.0.1',
 'REMOTE_PORT': '52669',
 'REQUEST_METHOD': 'GET',
 'REQUEST_URI': '/admin/cms/page/1/js/csrf.js/',
 'SCRIPT_FILENAME': '/home/[redacted]/webapps/django/[redacted].wsgi',
 'SCRIPT_NAME': u'',
 'SERVER_ADDR': '127.0.0.1',
 'SERVER_ADMIN': '[no address given]',
 'SERVER_NAME': '[redacted]',
 'SERVER_PORT': '80',
 'SERVER_PROTOCOL': 'HTTP/1.0',
 'SERVER_SIGNATURE': '',
 'SERVER_SOFTWARE': 'Apache/2.2.15 (Unix) mod_wsgi/3.2 Python/2.6.5',
 'mod_wsgi.application_group': '[redacted]',
 'mod_wsgi.callable_object': 'application',
 'mod_wsgi.handler_script': '',
 'mod_wsgi.input_chunked': '0',
 'mod_wsgi.listener_host': '',
 'mod_wsgi.listener_port': '43216',
 'mod_wsgi.process_group': '',
 'mod_wsgi.request_handler': 'wsgi-script',
 'mod_wsgi.script_reloading': '1',
 'mod_wsgi.version': (3, 2),
 'wsgi.errors': <mod_wsgi.Log object at 0x9eccb88>,
 'wsgi.file_wrapper': <built-in method file_wrapper of mod_wsgi.Adapter object at 0x9f86530>,
 'wsgi.input': <mod_wsgi.Input object at 0xa0cbb10>,
- Hide quoted text -
 'wsgi.multiprocess': False,
 'wsgi.multithread': True,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'https',
 'wsgi.version': (1, 1)}>

Can't really figure out what's going on.


回答1:


Simply forgot to add

'cms.context_processors.media',

in my TEMPLATE_CONTEXT_PROCESSORS tuple!



来源:https://stackoverflow.com/questions/7302149/django-cms-javascript-500-errors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!