Customizing css file in django-oscar using less - css

I am fairly new to django oscar and only have basic understanding of website front end.
I want to change the styles.css in django oscar. I have tried to change directly in styles.css but somehow when I refresh the localhost detects no changes (default css).
I've tried to change the less file, install npm, install less and change the setting into OSCAR_USE_LESS = True. The localhost didn't even render the css file at all, only the template.
When I write the command make css in root directory, following error occurred even though I've installed less.
make: *** No rule to make target `css'. Stop.
so I really don't know what is wrong with my setting or installed apps.
Settings are
import os
import oscar
# Path helper - going into /Users/dion/Dev/dioncoffee/x
location = lambda x: os.path.join(
os.path.dirname(os.path.dirname(os.path.realpath(__file__))), x)
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '=%*t%wzzw^hs5l2o#oq2ae-*&wde0bko4!hxl%=uqb$!5po$tt'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
from oscar import get_core_apps
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.flatpages',
'django_extensions',
'compressor',
#'apps.gateway', # For allowing dashboard access
'widget_tweaks',
] + get_core_apps(
['apps.promotions']
)
SITE_ID = 1
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'oscar.apps.basket.middleware.BasketMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
]
ROOT_URLCONF = 'dioncoffee.urls'
from oscar import OSCAR_MAIN_TEMPLATE_DIR
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
location('dioncoffee/templates'),
oscar.OSCAR_MAIN_TEMPLATE_DIR,
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.i18n',
'django.contrib.messages.context_processors.messages',
'oscar.apps.search.context_processors.search_form',
'oscar.apps.promotions.context_processors.promotions',
'oscar.apps.checkout.context_processors.checkout',
'oscar.apps.customer.notifications.context_processors.notifications',
'oscar.core.context_processors.metadata',
],
},
},
]
WSGI_APPLICATION = 'dioncoffee.wsgi.application'
# Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'dioncoffee',
'USER': 'dion',
'PASSWORD': '',
'HOST': '127.0.0.1',
'PORT': '',
}
}
# Password validation
# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
AUTHENTICATION_BACKENDS = (
'oscar.apps.customer.auth_backends.EmailBackend',
'django.contrib.auth.backends.ModelBackend',
)
# Internationalization
# https://docs.djangoproject.com/en/2.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
},
}
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/
# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = location("public/media")
STATIC_ROOT = location('public/static')
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = '/media/'
STATIC_URL = '/static/'
# /Users/dion/Dev/dioncoffee/static/
STATICFILES_DIRS = (
location('static'),
)
from oscar.defaults import *
OSCAR_DEFAULT_CURRENCY = 'EUR'
OSCAR_CURRENCY_FORMAT = {
'USD': {
'currency_digits': False,
'format_type': "accounting",
},
'EUR': {
'format': u'#,##0\xa0ยค',
}
}
USE_LESS = True
COMPRESS_ENABLED = False
COMPRESS_PRECOMPILERS = (
('text/less', 'lessc {infile} {outfile}'),
)
COMPRESS_OFFLINE_CONTEXT = {
'STATIC_URL': 'STATIC_URL',
'use_less': USE_LESS,
}
My directory files
And I am using python 3.6.5.

make css is intended only for development on Oscar itself - it will not work in your project. I can't see why the USE_LESS approach would fail if you are in debug mode though.
That said, I think you are better off overriding the CSS rather than relying on USE_LESS which is likely to be removed completely in the future, and is only really intended for development.
You should be able to override the CSS if you are putting in the right place.
If you have your CSS inside an app, then it needs to go inside app_dir/static/oscar/css/style.css and you need to have 'django.contrib.staticfiles.finders.AppDirectoriesFinder' in the STATICFILES_FINDERS setting.
Alternatively if you have a separate directory for static files then you need to include 'django.contrib.staticfiles.finders.FileSystemFinder' in the setting, and also specify STATICFILES_DIRS to tell Django where this directory is.

Related

Encore Webpack - Copy folders structure with copy-webpack-plugin

I'm using Symfony 5 and copy-webpack-plugin. I would like copy this structure from assets/fonts to public/build/fonts :
assets
----fonts
--------folder1
------------subFolder1.1
----------------file1.1.1
----------------file1.1.2
------------file1.2
------------file1.3
--------folder2
------------subFolder2.1
----------------file2.1.1
----------------file2.1.2
------------file2.2
------------file2.3
--------file3
--------file4
I have this webpack configuration :
const CopyWebpackPlugin = require('copy-webpack-plugin');
.addPlugin(new CopyWebpackPlugin(
[{
patterns: [{
from: '**/*.*',
to: 'fonts',
context: './fonts',
force: true
}]
}],
{
copyUnmodified: true
}
))
However, it doesn't work. I tried a lot of different configurations, to no avail.

cx_freeze include css file and image in dash app

I have some difficulties to apply a css file to my dash app when using cx_freeze. If I run python app.py the layout is properly applied, however not if I am executing the .exe generated by cx_freeze. Then the default html layout is displayed. The css and the image appear in the same directory where the .exe is located.
This is how my setup.py looks like.
from setuptools import find_packages
from cx_Freeze import setup, Executable
options = {
'build_exe': {
'includes': [
'cx_Logging', 'idna', 'idna.idnadata'
],
'packages': [
'asyncio', 'flask', 'jinja2', 'dash', 'plotly', 'waitress'
],
'excludes': ['tkinter'],
'include_files': [
'assets/logo.jpg', 'assets/style.css'
],
}
}
executables = [
Executable('server.py',
base='console',
targetName='dash_app.exe')
]
setup(
name='BI_Report',
packages=find_packages(),
version='0.0.1',
description='rig',
executables=executables,
options=options
)
To load the external files I use a helper function as suggested here:
def find_data_file(filename):
if getattr(sys, 'frozen', False):
# The application is frozen
datadir = os.path.dirname(sys.executable)
else:
# The application is not frozen
# Change this bit to match where you store your data files:
datadir = os.path.dirname(__file__)
return os.path.join(datadir, filename)
app = dash.Dash(__name__,
assets_folder=find_data_file('assets/'))
I am using:
Python 3.7.6
dash 1.9.1
cx-freeze 6.1
Any help much appreciated!

change background color of placeholder django cms

I want user to be able change colors of placeholders.
I try to install djangocms-css-background.
I fallowed these steps https://pypi.python.org/pypi/djangocms-css-background/1.0.4
at first i had error : "no module found djangocms-css-background" When i ran python manage migrate.
Somehow i fixed an error. But im stucked with this one
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'
)
i tried
python manage.py makemigrations djangocms-css-background
and i get same error
I see in readme syntax with +. Wherever i put +, I get an error "invalid sintax".
I'm using django 1.10, python 2.7
If someone have any suggestion or other idea to do this.
Thanks for help
The person who has created the djangocms-css-background package has named the app poorly, as python does not like file names to contain a hyphen (-). They should have named the top level directory in the package as djangocms_css_background.
The repository and pypi package are fine to contain a hyphen, it's just the app directory.
This is why you're having problems.
That package is depreciated and no longer maintained and having a quick scan through has a few problems.
You could fork the package, resolve the problems, then install your version of the package.
But what exactly are you trying to do as I'm not overly clear from the question. If you'd like to be able to change the background colour of a container (like this app allows you to), it's really quite simple to recreate. I'm just not 100% what you mean by the "background colour of a placeholder".
If you provide more information, I may be able to help you further.

Django CMS pages not visible after server restart

I've been using django-cms to build a simple website for my GF. I was editing the base template and for some reason my changes were not going through, so I restarted the nginx server script only to find out to my horror, that I can't see any of the page content anymore, only their names in the tree in the admin interface. If I try to go to a page, it claims the page does not exist.
I thought maybe there is something wrong with the setup so I ran fix-tree and migrate (which might have been an error on my part) and now even the page names are not visible anymore in the admin interface. The pages and their contents are in the database, but they are not accessible anymore.
Has anyone run into a similar issue? What could be a possible cause / solution for this? Any ideas where to look
My guess is that something was wrong with the setup or perhaps I had a wrong version of some package and then I didn't run into trouble until I restarted.
I would love to have all those pages back especially that they still exist in the DB. Will be eternally grateful for any help.
EDIT
I just tried creating a new page. I was able to do this without any errors, the page is visible in the database but it is not visible in on the "Pages" page and the page slug gives an 404 error.
EDIT 2
Here's the requirements.txt
aldryn-apphooks-config==0.2.7
aldryn-boilerplates==0.7.4
aldryn-bootstrap3==1.0.10
aldryn-categories==1.0.3
aldryn-common==1.0.4
aldryn-newsblog==1.2.4
aldryn-people==1.2.1
aldryn-reversion==1.0.9
aldryn-style==1.1.1
aldryn-translation-tools==0.2.1
aldryn-video==1.0.0
Babel==2.3.4
backport-collections==0.1
beautifulsoup4==4.4.1
dj-database-url==0.4.1
Django==1.8.15
django-appconf==1.0.2
django-appdata==0.1.5
django-classy-tags==0.8.0
django-cms==3.2.5
django-durationfield==0.5.2
django-filer==1.2.4
django-formtools==1.0
django-mptt==0.8.6
django-parler==1.6.5
django-phonenumber-field==1.1.0
django-polymorphic==0.8.1
django-reversion==1.8.7
django-sekizai==0.10.0
Django-Select2==4.3.2
django-sortedm2m==1.3.2
django-taggit==0.21.2
django-treebeard==4.0.1
djangocms-admin-style==1.2.3
djangocms-attributes-field==0.1.1
djangocms-column==1.6.0
djangocms-file==1.0
djangocms-googlemap==0.5.1
djangocms-inherit==0.2.1
djangocms-installer==0.8.7
djangocms-link==1.8.2
djangocms-picture==0.2.0
djangocms-style==1.7.0
djangocms-teaser==0.2.0
djangocms-text-ckeditor==3.1.0
djangocms-video==1.0.0
easy-thumbnails==2.3
gevent==1.1rc3
greenlet==0.4.9
gunicorn==18.0
html5lib==0.9999999
jsonfield==1.0.3
lxml==3.6.4
micawber==0.3.3
phonenumbers==7.5.2
phonenumberslite==7.5.2
Pillow==3.3.1
psycopg2==2.6.1
python-dateutil==2.5.3
python-slugify==1.2.0
pytz==2016.6.1
six==1.10.0
tzlocal==1.2.2
Unidecode==0.4.19
virtualenv==15.0.1
webencodings==0.5
YURL==0.13
And here's the settings file:
import os
gettext = lambda s: s
DATA_DIR = os.path.dirname(os.path.dirname(__file__))
"""
Django settings for anninsivut project.
Generated by 'django-admin startproject' using Django 1.8.14.
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 = 'VERY SECRET'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['.site.com', ]
# Application definition
ROOT_URLCONF = 'anninsivut.urls'
WSGI_APPLICATION = 'anninsivut.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/Amsterdam'
USE_I18N = False
USE_L10N = False
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, 'anninsivut', 'media')
STATIC_ROOT = os.path.join(DATA_DIR, 'anninsivut', 'static')
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'anninsivut', 'common_static'),
)
SITE_ID = 1
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'anninsivut', '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',
'aldryn_boilerplates.context_processors.boilerplate',
],
'loaders': [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
'django.template.loaders.eggs.Loader',
'aldryn_boilerplates.template_loaders.AppDirectoriesLoader',
],
},
},
]
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',
'djangocms_style',
'djangocms_column',
'djangocms_file',
'djangocms_googlemap',
'djangocms_inherit',
'djangocms_link',
'djangocms_picture',
'djangocms_teaser',
'aldryn_video',
'reversion',
'aldryn_apphooks_config',
'aldryn_boilerplates',
'aldryn_categories',
'aldryn_common',
'aldryn_translation_tools',
'aldryn_newsblog',
'aldryn_people',
'aldryn_reversion',
'aldryn_bootstrap3',
'parler',
'sortedm2m',
'taggit',
'easy_thumbnails',
'filer',
'anninsivut'
)
LANGUAGES = (
## Customize this
('en', gettext('en')),
)
ALDRYN_BOILERPLATE_NAME = 'bootstrap3'
STATICFILES_FINDERS = [
'django.contrib.staticfiles.finders.FileSystemFinder',
'aldryn_boilerplates.staticfile_finders.AppDirectoriesFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
]
CMS_LANGUAGES = {
## Customize this
1: [
{
'name': gettext('en'),
'redirect_on_fallback': True,
'code': 'en',
'public': True,
'hide_untranslated': False,
},
],
'default': {
'redirect_on_fallback': True,
'hide_untranslated': False,
'public': True,
},
}
THUMBNAIL_PROCESSORS = (
'easy_thumbnails.processors.colorspace',
'easy_thumbnails.processors.autocrop',
# 'easy_thumbnails.processors.scale_and_crop', # disable this one
'filer.thumbnail_processors.scale_and_crop_with_subject_location',
'easy_thumbnails.processors.filters',
)
CMS_TEMPLATES = (
## Customize this
('page.html', 'Page'),
('feature.html', 'Page with Feature')
)
CMS_PERMISSION = True
CMS_PLACEHOLDER_CONF = {}
DATABASES = {
'default': {
'CONN_MAX_AGE': 0,
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'HOST': 'localhost',
'NAME': 'anninsivut_DB',
'PASSWORD': 'password',
'PORT': '',
'USER': 'user'
}
}
DEFAULT_FROM_EMAIL = 'name#domain.com'
SERVER_EMAIL = 'name#domain.com'
ADMINS = (
('Your name', 'your email address'),
)
MIGRATION_MODULES = {
}
#Paulo Thanks for asking for these. Now that I looked at the requirements and settings file, I see that the requirements file I had on my local Pycharm dir had not synced with the one on the server. At some point I must've accidentally upgraded to Django 1.9 in the venv of the server. Now I guess that when I restarted that's when the Django-CMS picked up the change and lost the page contents. Then when I saw the loss and downgraded back to 1.8, that's when I lost the page names as well on the pages tree. I'll start by going through the changes between the two and also see if the packages are up to date with what they should be.
OK I managed to fix. After stepping through the code in the debugger in Pycharm, I realized I accidentally commented out the
LANGUAGE_CODE = 'en'
line in settings with made Django revert back to LANGUAGE_CODE = 'en-us', and that why it couldn't find the pages.
I also had a syncing problem between PyCharm and the deployment server, which is why the LANGUAGE_CODE = 'en' was not commented out in the settings.py I posted here.
So in short:
TIL that the language code must match in both
LANGUAGE_CODE = 'en'
and
CMS_LANGUAGES = {
1: [
{
'name': gettext('en'),
'redirect_on_fallback': True,
'code': 'en',
'public': True,
'hide_untranslated': False,
},
],
'default': {
'redirect_on_fallback': True,
'hide_untranslated': False,
'public': True,
},
}

Configuring autogrow plugin with djangocms-text-ckeditor

I am trying to use the autogrow plugin for ckeditor. As I am new to django and ckeditor I am having trouble with configuration. My settings are not being recognized. Below is a list of steps. I have seen reference to having to build ckeditor over again. I do not know if this is needed.
Platform: Ubuntu, django-cms 3 beta, djangocms-text-ckeditor (installed used pip in virtualenv), python 2.7.
I do not know exactly what I need to do, but I changed the following anyway.
S1. In project's settings.py, added
CKEDITOR_SETTINGS = getattr(settings, 'CKEDITOR_SETTINGS', {
'config.autoGrow_onStartup': True,
'config.autoGrow_minHeight': 200,
'config.autoGrow_maxHeight': 400,
})
S2. In ../site-packages/django_text_ckeditor/static/ckeditor/config.js, edited
CKEDITOR.editorConfig = function( config ) {
// Define changes to default configuration here. For example:
// config.language = 'fr';
// config.uiColor = '#AADC6E';
config.autoGrow_onStartup = true;
config.autoGrow_minHeight = 2000;
config.autoGrow_maxHeight = 4000;
};
S3. Added the autogrow plugin folder to
"../site-packages/django_text_ckeditor/static/ckeditor/plugins/autogrow"
S4. Modified line 45 of
"../site-packages/django_text_ckeditor/static/js/cms.ckeditor.js"
'extraPlugins': 'cmsplugins, autogrow'
S5. Added an extra statement after line 58 of
"../site-packages/django_text_ckeditor/static/js/cms.ckeditor.js"
// this is line 58
CKEDITOR.plugins.addExternal('cmsplugins', settings.static_url + 'ckeditor_plugins/cmsplugins/');
// this is the added line
CKEDITOR.plugins.addExternal('autogrow', settings.static_url + 'ckeditor/plugins/autogrow');
Do not know what else to do? Thoughts? Advice?
I'am using standard django-ckeditor from here: https://github.com/django-ckeditor/django-ckeditor
Your Step S2 and S4 and S5 are not needed. It makes no sens to modify the source of ckeditor. Just download the autogrow plugin from http://ckeditor.com/addon/autogrow and config with settings.py:
CKEDITOR_CONFIGS = {
'default': {
'autoGrow_onStartup': True,
'autoGrow_minHeight': 100,
'autoGrow_maxHeight': 650,
'extraPlugins': 'autogrow',
'toolbar': 'Custom',
'toolbar_Custom': [
['Bold', 'Italic', 'Underline'],
['Format'],
#['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
['Link', 'Unlink'],
['RemoveFormat', 'Source']
],
}
}

Resources