私のプロジェクトは、MySQL で動作する django-cms 2.4.1 の新しいインストールです。
ページ リスト インターフェイスを介してページを公開または非公開にしようとすると、「未定義」という文字列を含む Javascript 警告エラーが表示されます。奇妙なことは、エラーにもかかわらずアクション (公開または非公開) を実行することです。公開しようとするとチェックボックスが有効になりませんが、ページをリロードすると、公開済みでチェック済みと表示されます。非公開にしようとすると、チェックボックスが無効になります。
編集フォームからこのアクションを実行しようとすると、完全に機能することを強調しておきます。
私のsettings.pyには、それを引き起こしている可能性のある問題はないようです。
Chrome インスペクタを使用して ajax リクエストを調べたところ、すべて問題ないようです。
応答は次のように問題ありません。
Request URL: http://127.0.0.1:8000/admin/cms/page/11/change-status/
Request Method:POST
Status Code:200 OK!
皆さん、手を貸してください。
これは私のsettings.pyです:
# -*- coding: utf-8 -*-
import os
gettext = lambda s: s
from datetime import datetime
from run_locale import local_run
PROJECT_DIR = os.path.abspath(os.path.dirname(__file__))
PROJECT_NAME='zecaffe'
PRODUCTION = False
TESTE_SERVER = False
DEBUG = True
print "Running at: "+local_run
if local_run == 'producao':
PRODUCTION = True
DEBUG = False
elif local_run == 'teste':
TESTE_SERVER = True
TEMPLATE_DEBUG = DEBUG
if PRODUCTION and TESTE_SERVER:
raise Exception(u"""
Django: Conflito de configuração. Apenas uma entre as variáveis PRODUCTION e TESTE_SERVER
pode ser definida como True.
"""
)
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
if PRODUCTION:
PAGE_TO_EMAIL = 'email@example.com.br'
elif TESTE_SERVER:
PAGE_TO_EMAIL = 'email@example.com.br'
else:
PAGE_TO_EMAIL = 'email@example.com.br'
CMS_SEO_FIELDS = True
CMS_REDIRECTS = True
if PRODUCTION:
DATABASES = {
'default': {
'ENGINE' : 'django.db.backends.mysql',
'NAME' : '[database-name]',
'USER' : '[database-user]',
'PASSWORD' : '[databse-pass]',
'HOST' : 'localhost',
'PORT' : '',
}
}
elif TESTE_SERVER:
DATABASES = {
'default': {
'ENGINE' : 'django.db.backends.mysql',
'NAME' : '[database-name]',
'USER' : '[database-user]',
'PASSWORD' : '[databse-pass]',
'HOST' : 'localhost',
'PORT' : '',
}
}
else:
DATABASES = {
'default': {
'ENGINE' : 'django.db.backends.mysql',
'NAME' : '[database-name]',
'USER' : '[database-user]',
'PASSWORD' : '[databse-pass]',
'HOST' : 'localhost',
'PORT' : '',
}
}
TIME_ZONE = 'America/Sao_Paulo'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'pt-br'
LANGUAGES = (
('pt-br', gettext(u'Português Brasil')),
)
"""
CMS_LANGUAGES = {
1: [
{
'code': 'pt-br',
'name': gettext(u'Português Brasil'),
#'fallbacks': ['de', 'fr'],
'public': True,
'hide_untranslated': False,
'redirect_on_fallback':False,
},
],
'default': {
'fallbacks': ['pt-br'],
'redirect_on_fallback':True,
'public': False,
'hide_untranslated': False,
}
}
"""
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
if PRODUCTION:
# Caminho absoluto dentro do servidor
MEDIA_ROOT = '/home/[user]/webapps/zecaffe/zecaffe/media/'
STATIC_ROOT = '/home/[user]/webapps/zecaffe/zecaffe/static/'
elif TESTE_SERVER:
MEDIA_ROOT = '/home/[user]/webapps/teste_zecaffe/zecaffe/media/'
STATIC_ROOT = '/home/[user]/webapps/teste_zecaffe/zecaffe/static/'
else:
MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media')
STATIC_ROOT = os.path.join(PROJECT_DIR, 'static')
MEDIA_URL = '/media/'
STATIC_URL = '/static/'
ADMIN_MEDIA_PREFIX = '/static/admin/'
# Additional locations of static files
STATICFILES_DIRS = (
('admin', os.path.join(STATIC_ROOT, 'admin')),
('cms', os.path.join(STATIC_ROOT, 'cms')),
('ckeditor', os.path.join(STATIC_ROOT, 'ckeditor')),
('css', os.path.join(STATIC_ROOT, 'css')),
('img', os.path.join(STATIC_ROOT, 'img')),
('js', os.path.join(STATIC_ROOT, 'js')),
('jquery_ui', os.path.join(STATIC_ROOT, 'jquery_ui')),
('galleria', os.path.join(STATIC_ROOT, 'galleria')),
#('font-face', os.path.join(STATIC_ROOT, 'font-face')),
)
# 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 = '-----------------------------------'
# 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.locale.LocaleMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
'zecaffe.middlewares.ThreadLocals'
#'django_globals.middleware.Global',
)
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.request',
'django.core.context_processors.media',
'django.core.context_processors.static',
'django.core.context_processors.tz',
'cms.context_processors.media',
'sekizai.context_processors.sekizai',
'core.context_processors.crop_settings',
'core.context_processors.paginas',
'core.context_processors.revisao',
'core.context_processors.site_domain',
'core.context_processors.facebook_settings',
'core.context_processors.twitter_settings',
)
CMS_TEMPLATES = (
('index.html', u'Template | Início'),
#('colunas_inicio.html', u'Template | Colunas Início'),
#('colunas_colunista.html', u'Template | Colunas Colunista'),
('contato.html', u'Template | Contato'),
)
ROOT_URLCONF = '%s.urls' % PROJECT_NAME
TEMPLATE_DIRS = (
os.path.join(PROJECT_DIR, 'templates'),
)
#----------------------------CKEDITOR SETTINGS--------------------------------#
CKEDITOR_MEDIA_PREFIX = "/media/ckeditor/"
if PRODUCTION:
CKEDITOR_UPLOAD_PATH = '/home/[user]/webapps/zecaffe/zecaffe/media/ckeditor_imgs/'
elif TESTE_SERVER:
CKEDITOR_UPLOAD_PATH = '/home/[user]/webapps/teste_zecaffe/zecaffe/media/ckeditor_imgs/'
else:
CKEDITOR_UPLOAD_PATH = os.path.join(PROJECT_DIR, 'media/ckeditor_imgs/')
#CKEDITOR_UPLOAD_PREFIX = "http://localhost:8000/media/ckeditor_imgs/"
CKEDITOR_CONFIGS = {
'default': {
'toolbar': 'Full',
'height': 300,
'width': 1200,
#'skin' : 'v2',
},
}
#-----------------------------------------------------------------------------#
# ------------------ MYOWN SETTINGS ------------------#
DEBUG_EXCEPTIONS = True
if PRODUCTION:
REVISAO = '55a88aa'
else:
REVISAO = time = int(datetime.now().microsecond)
if PRODUCTION:
SITE_DOMAIN = 'http://zecaffe.com.br/'
elif TESTE_SERVER:
SITE_DOMAIN = 'http://teste.zecaffe.com.br/'
else:
SITE_DOMAIN = 'http://localhost:8000/'
if PRODUCTION or TESTE_SERVER:
FACEBOOK_APP_ID = '-----'
FACEBOOK_APP_SECRET = '------'
TWITTER_CONSUMER_KEY = '------'
TWITTER_CONSUMER_SECRET = '------'
else:
FACEBOOK_APP_ID = ''
FACEBOOK_APP_SECRET = ''
TWITTER_CONSUMER_KEY = '------'
TWITTER_CONSUMER_SECRET = '-------'
CROP_SETTINGS = {
'noticia':{
'imagem_original' : (640, 480),
'imagem_destaque_g_temp' : (286, 156),
'imagem_destaque_p_temp' : (200, 220),
'imagem_destaque_w_temp' : (71, 71),
},
'galeria_imagem':{
'imagem_light_box' : (800, 600),
'imagem_slide' : (700, 350),
'thumb' : (125, 80),
}
}
#----------------------------------------------------------#
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.admin',
'django.contrib.staticfiles',
'cms',
'menus',
'mptt',
'south',
'sekizai',
'cms.plugins.text',
'cms.plugins.picture',
'cms.plugins.link',
'cms.plugins.file',
'cms.plugins.flash',
'cms.plugins.teaser',
'cms.plugins.video',
'cms.plugins.twitter',
'cms.plugins.snippet',
'cms.plugins.googlemap',
'ckeditor',
'core',
'noticia',
'social',
)
"""
CMS_PLACEHOLDER_CONF = {
'content': {
'plugins': ['TextPlugin', 'PicturePlugin'],
'text_only_plugins': ['LinkPlugin'],
'extra_context': {"width":640},
'name':gettext("Content"),
},
'right-column': {
"plugins": ['TeaserPlugin', 'LinkPlugin'],
"extra_context": {"width":280},
'name':gettext("Right Column"),
'limits': {
'global': 2,
'TeaserPlugin': 1,
'LinkPlugin': 1,
},
},
'base.html content': {
"plugins": ['TextPlugin', 'PicturePlugin', 'TeaserPlugin']
},
}
"""
EMAIL_HOST = 'smtp.webfaction.com'
EMAIL_HOST_USER = '[mailbox]'
EMAIL_HOST_PASSWORD = '[mailbox-pass]'
DEFAULT_FROM_EMAIL = 'email@example.com.br'
SERVER_EMAIL = 'email@example.com.br'
EMAIL_PORT = 587
EMAIL_SUBJECT_PREFIX = u'Zé Caffé'
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,
},
}
}
皆さん、手を貸してください。
これは私のsettings.pyです
皆さん、手を貸してください。