2016-10-31 3 views
1

사용자가 자리 표시 자의 색상을 변경할 수있게하려고합니다.자리 표시 자 django cms의 배경색을 변경

djangocms-css-background를 설치하려고합니다. 나는이 단계를 fallowed했다 https://pypi.python.org/pypi/djangocms-css-background/1.0.4

처음에 나는 오류가 있었다 : "아무 모듈도 djangocms-css-background를 찾지 못했습니다."

어떻게 든 오류가 수정되었습니다. 하지만

python manage.py makemigrations djangocms-css-background 

노력이 하나

djangocms-css-background.CssBackground.cmsplugin_ptr: (fields.E306) The name 'djangocms-css-background_cssbackground' is invalid related_name for field CssBackground.cmsplugin_ptr 
    HINT: Related name must be a valid Python identifier or end with a '+' 

settings.py

import os 
gettext = lambda s: s 
DATA_DIR = os.path.dirname(os.path.dirname(__file__)) 
""" 
Django settings for mysite project. 

Generated by 'django-admin startproject' using Django 1.8.15. 

For more information on this file, see 
https://docs.djangoproject.com/en/1.8/topics/settings/ 

For the full list of settings and their values, see 
https://docs.djangoproject.com/en/1.8/ref/settings/ 
""" 

# Build paths inside the project like this: os.path.join(BASE_DIR, ...) 
import os 

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 


# Quick-start development settings - unsuitable for production 
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ 

# SECURITY WARNING: keep the secret key used in production secret! 
SECRET_KEY = '6!we3efe11p$%8x#r3y_)pioj5&-%%$g5ezmu2m_dm(^_f^2m8' 

# SECURITY WARNING: don't run with debug turned on in production! 
DEBUG = True 

ALLOWED_HOSTS = [] 


# Application definition 





ROOT_URLCONF = 'mysite.urls' 



WSGI_APPLICATION = 'mysite.wsgi.application' 


# Database 
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases 




# Internationalization 
# https://docs.djangoproject.com/en/1.8/topics/i18n/ 

LANGUAGE_CODE = 'en' 

TIME_ZONE = 'Europe/Ljubljana' 

USE_I18N = True 

USE_L10N = True 

USE_TZ = True 


# Static files (CSS, JavaScript, Images) 
# https://docs.djangoproject.com/en/1.8/howto/static-files/ 
STATIC_URL = '/static/' 
MEDIA_URL = '/media/' 
MEDIA_ROOT = os.path.join(DATA_DIR, 'media') 
STATIC_ROOT = os.path.join(DATA_DIR, 'static') 

STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'mysite', 'static'), 
) 
SITE_ID = 1 


TEMPLATES = [ 
    { 
     'BACKEND': 'django.template.backends.django.DjangoTemplates', 
     'DIRS': [os.path.join(BASE_DIR, 'mysite', 'templates'),], 
     'OPTIONS': { 
      'context_processors': [ 
       'django.contrib.auth.context_processors.auth', 
    'django.contrib.messages.context_processors.messages', 
    'django.core.context_processors.i18n', 
    'django.core.context_processors.debug', 
    'django.core.context_processors.request', 
    'django.core.context_processors.media', 
    'django.core.context_processors.csrf', 
    'django.core.context_processors.tz', 
    'sekizai.context_processors.sekizai', 
    'django.core.context_processors.static', 
    'cms.context_processors.cms_settings' 
      ], 
      'loaders': [ 
       'django.template.loaders.filesystem.Loader', 
    'django.template.loaders.app_directories.Loader', 
    'django.template.loaders.eggs.Loader' 
      ], 
     }, 
    }, 
] 


MIDDLEWARE_CLASSES = (
    'cms.middleware.utils.ApphookReloadMiddleware', 
    'django.contrib.sessions.middleware.SessionMiddleware', 
    'django.middleware.csrf.CsrfViewMiddleware', 
    'django.contrib.auth.middleware.AuthenticationMiddleware', 
    'django.contrib.messages.middleware.MessageMiddleware', 
    'django.middleware.locale.LocaleMiddleware', 
    'django.middleware.common.CommonMiddleware', 
    'django.middleware.clickjacking.XFrameOptionsMiddleware', 
    'cms.middleware.user.CurrentUserMiddleware', 
    'cms.middleware.page.CurrentPageMiddleware', 
    'cms.middleware.toolbar.ToolbarMiddleware', 
    'cms.middleware.language.LanguageCookieMiddleware' 
) 

INSTALLED_APPS = (
    'djangocms_admin_style', 
    'django.contrib.auth', 
    'django.contrib.contenttypes', 
    'django.contrib.sessions', 
    'django.contrib.admin', 
    'django.contrib.sites', 
    'django.contrib.sitemaps', 
    'django.contrib.staticfiles', 
    'django.contrib.messages', 
    'cms', 
    'menus', 
    'sekizai', 
    'treebeard', 
    'djangocms_text_ckeditor', 
    'filer', 
    'easy_thumbnails', 
    'djangocms_column', 
    'djangocms_link', 
    'cmsplugin_filer_file', 
    'cmsplugin_filer_folder', 
    'cmsplugin_filer_image', 
    'cmsplugin_filer_utils', 
    'djangocms_style', 
    'djangocms_snippet', 
    'djangocms_googlemap', 
    'djangocms_video', 
    'mysite', 
    'djangocms-css-background' 

) 

LANGUAGES = (
    ## Customize this 
    ('en', gettext('en')), 
) 

CMS_LANGUAGES = { 
    ## Customize this 
    'default': { 
     'public': True, 
     'hide_untranslated': False, 
     'redirect_on_fallback': True, 
    }, 
    1: [ 
     { 
      'public': True, 
      'code': 'en', 
      'hide_untranslated': False, 
      'name': gettext('en'), 
      'redirect_on_fallback': True, 
     }, 
    ], 
} 

CMS_TEMPLATES = (
    ## Customize this 
    ('fullwidth.html', 'Fullwidth'), 
    ('sidebar_left.html', 'Sidebar Left'), 
    ('sidebar_right.html', 'Sidebar Right'), 
    ('template_1.html', 'Template One'), 
    ('template_2.html', 'Template Two') 
) 

CMS_PERMISSION = True 

CMS_PLACEHOLDER_CONF = {} 

DATABASES = { 
    'default': { 
     'CONN_MAX_AGE': 0, 
     'ENGINE': 'django.db.backends.sqlite3', 
     'HOST': 'localhost', 
     'NAME': 'project.db', 
     'PASSWORD': '', 
     'PORT': '', 
     'USER': '' 
    } 
} 

MIGRATION_MODULES = { 

} 

THUMBNAIL_PROCESSORS = (
    'easy_thumbnails.processors.colorspace', 
    'easy_thumbnails.processors.autocrop', 
    'filer.thumbnail_processors.scale_and_crop_with_subject_location', 
    'easy_thumbnails.processors.filters' 
) 

으로 stucked 메신저와 나는

내가 +와 추가 정보 구문에서 볼 같은 오류가 발생합니다. 어디든 +를 넣으면 "invalid sintax"오류가 발생합니다. 누군가가이 일을 어떤 제안이나 아이디어가 있다면 내가 장고 1.10, 파이썬 2.7

을 사용하고

. 도움을 주셔서 감사합니다

답변

0

djangocms-css-background 패키지를 만든 사람은 파이썬이 하이픈 (-)을 포함하는 파일 이름을 좋아하지 않으므로 앱의 이름을 잘못 지정했습니다. 패키지의 최상위 디렉토리 이름을 djangocms_css_background으로 지정해야합니다.

리포지토리와 pypi 패키지는 하이픈을 포함해도 괜찮습니다. 단지 응용 프로그램 디렉토리 일뿐입니다.

이 때문에 문제가 발생합니다.

해당 패키지는 가치가 떨어지고 더 이상 유지 관리되지 않으며 빠른 검사를 통해 약간의 문제가 있습니다.

패키지를 포크하여 문제를 해결 한 다음 패키지 버전을 설치할 수 있습니다.

하지만 정확히 내가 질문에서 지나치게 명확하지 않기 때문에 당신이하려는 것은 무엇입니까. 이 앱에서 허용하는 것처럼 컨테이너의 배경색을 변경할 수있게하려면 다시 작성하는 것이 매우 간단합니다. 나는 "자리 표시 자의 배경색"이 의미하는 바가 100 %는 아닙니다.

자세한 정보를 제공하면 도움을 드릴 수 있습니다.