# Django settings for CMS1 project.# -*- Coding: utf-8 -*-import osgettext = lambda s: sPROJECT_PATH = os.path.abspath(os.path.dirname(__file__))DEBUG = TrueTEMPLATE_DEBUG = DEBUGadminS = ( # ('Your name','[email protected]'),)MANAGERS = adminSDATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2',# Add 'postgresql_psycopg2','MysqL','sqlite3' or 'oracle'. 'name': 'CMS1',# Or path to database file if using sqlite3. 'USER': 'CMS',# Not used with sqlite3. 'PASSWORD': 'CMS',# Not used with sqlite3. 'HOST': '',# Set to empty string for localhost. Not used with sqlite3. 'PORT': '',# Set to empty string for default. Not used with sqlite3. }}# Local time zone for this installation. Choices can be found here:# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name# although not all choices may be available on all operating systems.# In a windows environment this must be set to your system time zone.TIME_ZONE = 'Europe/Rome'# Language code for this installation. All choices can be found here:# http://www.i18nguy.com/unicode/language-IDentifIErs.HTMLLANGUAGE_CODE = 'it-it'SITE_ID = 1# If you set this to False,Django will make some optimizations so as not# to load the internationalization machinery.USE_I18N = True# If you set this to False,Django will not format dates,numbers and# calendars according to the current locale.USE_L10N = True# If you set this to False,Django will not use timezone-aware datetimes.USE_TZ = True# absolute filesystem path to the directory that will hold user-uploaded files.# Example: "/home/media/media.laWrence.com/media/"MEDIA_ROOT = os.path.join(PROJECT_PATH,"media")# URL that handles the media served from MEDIA_ROOT. Make sure to use a# trailing slash.# Examples: "http://media.laWrence.com/media/","http://example.com/media/"MEDIA_URL = '/media/'# absolute path to the directory static files should be collected to.# Don't put anything in this directory yourself; store your static files# in apps' "static/" subdirectorIEs and in STATICfileS_Dirs.# Example: "/home/media/media.laWrence.com/static/"STATIC_ROOT = os.path.join(PROJECT_PATH,"static")STATIC_URL = "/static/"# Additional locations of static filesSTATICfileS_Dirs = ( os.path.join(PROJECT_PATH,"static_auto"),# Put strings here,like "/home/HTML/static" or "C:/www/django/static". # Always use forward slashes,even on windows. # Don't forget to use absolute paths,not relative paths.)# List of finder classes that kNow how to find static files in# varIoUs locations.STATICfileS_FINDERS = ( 'django.contrib.staticfiles.finders.fileSystemFinder','django.contrib.staticfiles.finders.AppDirectorIEsFinder',# 'django.contrib.staticfiles.finders.DefaultStorageFinder',)# Make this unique,and don't share it with anybody.SECRET_KEY = '^c2q3d8w)f#gk%5i)(#i*lwt%lm-!2=(*1d!1cf+rg&-hqi_9u'# List of callables that kNow how to import templates from varIoUs sources.TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader','django.template.loaders.app_directorIEs.Loader',# 'django.template.loaders.eggs.Loader',)MIDDLEWARE_CLASSES = ( 'django.mIDdleware.common.CommonMIDdleware','django.contrib.sessions.mIDdleware.SessionMIDdleware','django.mIDdleware.csrf.CsrfVIEwMIDdleware','django.contrib.auth.mIDdleware.AuthenticationMIDdleware','django.contrib.messages.mIDdleware.MessageMIDdleware','CMS.mIDdleware.multilingual.MultilingualURLMIDdleware','CMS.mIDdleware.page.CurrentPageMIDdleware','CMS.mIDdleware.user.CurrentUserMIDdleware','CMS.mIDdleware.toolbar.ToolbarMIDdleware',# Uncomment the next line for simple clickjacking protection: # 'django.mIDdleware.clickjacking.XFrameOptionsMIDdleware',)ROOT_URLconf = 'CMS1.urls'# Python dotted path to the Wsgi application used by Django's runserver.Wsgi_APPliCATION = 'CMS1.wsgi.application'TEMPLATE_Dirs = ( os.path.join(PROJECT_PATH,"templates"),like "/home/HTML/django_templates" or "C:/www/django/templates". # Always use forward slashes,not relative paths.)CMS_TEMPLATES = ( ('template_1.HTML','Template One'),('template_2.HTML','Template Two'),)TEMPLATE_CONTEXT_PROCESSORS = ( 'django.contrib.auth.context_processors.auth','django.core.context_processors.i18n','django.core.context_processors.request','django.core.context_processors.media','django.core.context_processors.static','CMS.context_processors.media','sekizai.context_processors.sekizai',)LANGUAGES = [ ('it','Italiano'),('en','English'),]INSTALLED_APPS = ( 'django.contrib.auth','django.contrib.ContentTypes','django.contrib.sessions','django.contrib.sites','django.contrib.messages','django.contrib.staticfiles','CMS',#django CMS itself 'mptt',#utilitIEs for implementing a modifIEd pre-order traversal tree 'menus',#helper for model independent hIErarchical website navigation 'south',#intelligent schema and data migrations 'sekizai',#for JavaScript and CSS management #'CMS.plugins.file','CMS.plugins.flash','CMS.plugins.Googlemap','CMS.plugins.link',#'CMS.plugins.picture','CMS.plugins.snippet','CMS.plugins.teaser','CMS.plugins.text',#'CMS.plugins.vIDeo','CMS.plugins.twitter','filer','CMSplugin_filer_file','CMSplugin_filer_folder','CMSplugin_filer_image','CMSplugin_filer_teaser','CMSplugin_filer_vIDeo','easy_thumbnails','PIL',# Uncomment the next line to enable the admin: 'django.contrib.admin',# Uncomment the next line to enable admin documentation: # 'django.contrib.admindocs',)# A sample logging configuration. The only tangible logging# performed by this configuration is to send an email to# the site admins on every http 500 error when DEBUG=False.# See http://docs.djangoproject.com/en/dev/topics/logging for# more details on how to customize your logging configuration.LOGGING = { 'version': 1,'disable_existing_loggers': False,'filters': { 'require_deBUG_false': { '()': 'django.utils.log.requiredeBUGFalse' } },'handlers': { 'mail_admins': { 'level': 'ERROR','filters': ['require_deBUG_false'],'class': 'django.utils.log.adminEmailHandler' } },'loggers': { 'django.request': { 'handlers': ['mail_admins'],'level': 'ERROR','propagate': True,},}}
当我尝试上传图片时,在剪贴板部分我没有缩略图,只是一个“未定义”的消息:
这是尝试上传时的runserver控制台:
[20/Oct/2012 15:15:56] "POST /admin/filer/clipboard/operations/upload/?qqfile=29708_1306856312320_7706073_n.jpg http/1.1" 500 248133[20/Oct/2012 15:15:56] "GET /it/admin/filer/folder/unfiled_images/undefined http/1.1" 301 0[20/Oct/2012 15:15:56] "GET /it/admin/filer/folder/unfiled_images/undefined/ http/1.1" 404 1739
此外,这是项目文件系统:
CMS1├── CMS1│ ├── __init__.py│ ├── __init__.pyc│ ├── media│ │ └── filer_public│ │ └── 2012│ │ └── 10│ │ └── 20│ │ ├── 29708_1306856312320_7706073_n_1.jpg│ │ ├── 29708_1306856312320_7706073_n_2.jpg│ │ ├── 29708_1306856312320_7706073_n_3.jpg│ │ ├── 29708_1306856312320_7706073_n_4.jpg│ │ ├── 29708_1306856312320_7706073_n_5.jpg│ │ ├── 29708_1306856312320_7706073_n_6.jpg│ │ ├── 29708_1306856312320_7706073_n_7.jpg│ │ ├── 29708_1306856312320_7706073_n.jpg│ │ └── torrent-clIEnt-macosx.jpg│ ├── settings.py│ ├── settings.pyc│ ├── static│ ├── static_auto│ ├── static_manual│ ├── templates│ │ ├── base.HTML│ │ ├── template_1.HTML│ │ └── template_2.HTML│ ├── urls.py│ ├── urls.pyc│ ├── wsgi.py│ └── wsgi.pyc└── manage.py
因此上传文件,但CMS无法访问它们.这里有一个similar question,但对我这么帮助.
对我这个问题的任何帮助都会非常有帮助.
谢谢,卢克
解决方法@H_301_22@ 此错误是因为您安装了PIL而没有JPEG / PNG支持.您需要安装以下软件包
sudo apt-get install python-imaging python-dev libjpeg8 libjpeg8-dev libfreetype6 libfreetype6-dev
然后卸载PIL pip卸载PIL
我建议使用pip安装枕头安装枕头代替PIL.确保在安装后阅读日志,应该说支持JPEG和PNG
总结以上是内存溢出为你收集整理的python – Django CMS – 无法通过cmsplugin_filer_image上传图像全部内容,希望文章能够帮你解决python – Django CMS – 无法通过cmsplugin_filer_image上传图像所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)