divio / django-cms-explorer

django CMS explorer theme example
30 stars 23 forks source link

Install instructions for basic django-cms without aldryn missing or wrong #18

Closed ghost closed 8 years ago

ghost commented 8 years ago

The install instructions for basic django-cms seem to imply simply copying the "django-cms-explorer" folder into the mysite/ directory should work. However, the link to the supposed detailed explanation seems to assume Aldryn Boilerplate is present / installed.

It would be nice if it was clarified if the instructions were clarified so it is obvious whether the install for regular django-cms works differently or if it's supposed to work like that as well, because when I tested it, it didn't seem to work. (page looks still the same, no obvious way to change to explorer theme)

Edit: if I was supposed to install Aldryn or something else first, that is totally not obvious from the current install instructions which seem to imply installing django-cms and then immediately dropping in the explorer theme as-is will work

FinalAngel commented 8 years ago

It should work, you just need to make sure that the templates and static directory are properly set in your settings.py. Can you post your settings configuration?

ghost commented 8 years ago

We automated the install which is just the basic djangocms -f -q --config-file /tmp/djangocms-installer.conf -p cmsmaindir mysite in a clean new virtualenv, with the config just modified for the database settings.

The resulting settings.py of that process is:


root@2f9fed63582d:/djangocms/cmsmaindir/mysite# cat 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.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 = '<RETRACTED>'

# 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 = 'de'

TIME_ZONE = 'Etc/UTC'

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',
    'djangocms_style',
    'djangocms_column',
    'filer',
    'easy_thumbnails',
    'cmsplugin_filer_image',
    'cmsplugin_filer_file',
    'cmsplugin_filer_folder',
    'cmsplugin_filer_teaser',
    'cmsplugin_filer_utils',
    'cmsplugin_filer_video',
    'djangocms_googlemap',
    'djangocms_inherit',
    'djangocms_link',
    'reversion',
    'mysite'
]

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

CMS_LANGUAGES = {
    ## Customize this
    'default': {
        'public': True,
        'hide_untranslated': False,
        'redirect_on_fallback': True,
    },
    1: [
        {
            'public': True,
            'code': 'de',
            'hide_untranslated': False,
            'name': gettext('de'),
            'redirect_on_fallback': True,
        },
        {
            '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')
)

CMS_PERMISSION = True

CMS_PLACEHOLDER_CONF = {}

DATABASES = {
    'default': {
        'CONN_MAX_AGE': 0,
        'ENGINE': 'django.db.backends.mysql',
        'HOST': 'mariadb',
        'NAME': 'djangocms',
        'PASSWORD': '<RETRACTED>',
        'PORT': '',
        'USER': 'djangocms'
    }
}

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'
)
root@2f9fed63582d:/djangocms/cmsmaindir/mysite#

The resulting site dir is: /djangoproject/cmsmaindir/mysite I put the contents of the git repository at: /djangoproject/cmsmaindir/mysite/django-cms-explorer/

ghost commented 8 years ago

Maybe I'm just too silly to find it? I'm quite new to django-cms... I'll search a bit more to be sure I haven't missed something.

FinalAngel commented 8 years ago

@JonasT I will have a closer look later this week.

FinalAngel commented 8 years ago

@JonasT so I just followed the "standard" procedure suggested by the installation instructions to get a project running:

virtualenv env
source env/bin/activate
pip install djangocms-installer
mkdir tutorial-project
cd tutorial-project
djangocms -f -p . mysite

Run the djangocms-installer using all default choices and then create a superuser and run the project:

python manage.py createsuperuser (admin/admin)
python manage.py runserver

Login and check that the project is running. Add the first page "Home" so we have the frontend exposed. Next download this repository and copy it as is into the mysite folder. Make sure to override everything.

Restart the server et voila:

image

ghost commented 8 years ago

Ah, I assumed copying it into "mysite" means copying it into "mysite/django-cms-explorer". If I'm actually supposed to copy the direct contents of the repository directly into the site folder, then it might be worth updating the instructions to make that more clear. (e.g. by adding an example that if the site is at /mydjango/mysite/ , then for example the bower.json needs to be at /mydjango/mysite/bower.json etc.)

However, we're probably not using django-cms anyway because sadly it doesn't seem to be well-maintained enough to even make basic image resizing in the article editor work out-of-the-box ( https://github.com/divio/django-cms/issues/5668 ) even without any additions/addons like this theme, so we're back to looking at wordpress again.... it's a shame because it seems to be ancient PHP code riddled with exploit over exploit with critical patches all the time, but at least it works without awkward surprises in even the most basic functionality.

FinalAngel commented 8 years ago

hello @JonasT I'll make sure to clarify this in the README. Thats sad to hear. Thanks for your feedback.