在Django-CMS中,我选择了图片插件并从我的硬盘中添加了一张图片,然后当我点击该图片插件时,我得到了如下所示的错误。这是什么原因?
ValueError at /admin/cms/page/2/edit-plugin/7/cms_page_media/2/parking_mockup.png/
invalid literal for int() with base 10: '2/edit-plugin/7/cms_page_media/2/parking_mockup.png'
Request Method: GET
Request URL: http://localhost:8000/admin/cms/page/2/edit-plugin/7/cms_page_media/2/parking_mockup.png/
Django Version: 1.3.1
Exception Type: ValueError
Exception Value:
invalid literal for int() with base 10: '2/edit-plugin/7/cms_page_media/2/parking_mockup.png'
Exception Location: C:\Python27\lib\site-packages\django\db\models\fields\__init__.py in get_prep_value, line 479
Python Executable: C:\Python27\python.exe
Python Version: 2.7.2
Python Path:
['C:\\djangoworkspace\\hulawai',
'C:\\Python27\\lib\\site-packages\\django_classy_tags-0.3.4.1-py2.7.egg',
'C:\\Python27\\lib\\site-packages\\django_sekizai-0.5-py2.7.egg',
'C:\\Python27\\lib\\site-packages\\html5lib-0.95-py2.7.egg',
'C:\\Python27\\lib\\site-packages\\virtualenv-1.7.1.2-py2.7.egg',
'C:\\Python27\\lib\\site-packages\\pip-1.1-py2.7.egg',
'C:\\Windows\\system32\\python27.zip',
'C:\\Python27\\DLLs',
'C:\\Python27\\lib',
'C:\\Python27\\lib\\plat-win',
'C:\\Python27\\lib\\lib-tk',
'C:\\Python27',
'C:\\Python27\\lib\\site-packages',
'C:\\Python27\\lib\\site-packages\\PIL']
Server time: Thu, 22 Mar 2012 11:03:58 +0100
Traceback Switch to copy-and-paste view
C:\Python27\lib\site-packages\django\core\handlers\base.py in get_response
for middleware_method in self._view_middleware:
response = middleware_method(request, callback, callback_args, callback_kwargs)
if response:
break
if response is None:
try:
response = callback(request, *callback_args, **callback_kwargs) ...
except Exception, e:
# If the view raised an exception, run it through exception
# middleware, and if the exception middleware returns a
# response, use that. Otherwise, reraise the exception.
for middleware_method in self._exception_middleware:
response = middleware_method(request, e)
更新此处提供完整的堆栈跟踪:https://gist.github.com/2157837
答案 0 :(得分:1)
我编辑了我的settings.py
这
MEDIA_URL = 'media/'
要
MEDIA_URL = 'http://localhost:8000/media/'