Rootbuzz / shpaml

Load shpaml (haml-like html alternative) templates in django seamlessly. Should work fine extending normal HTML templates and being extended by them.
http://shpaml.com
BSD 3-Clause "New" or "Revised" License
46 stars 9 forks source link

Shpaml does not seem to be compatible with Django 1.8/Python 2.7 at all. #20

Open bschuon opened 8 years ago

bschuon commented 8 years ago

When installing Shpaml in a Django 1.8/Python 2.7 system, as soon as the templates loaders settings is added, you get an error:

"Module "shpaml" does not define a "Loader" attribute/class"

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, "myproject", "templates")],
        'OPTIONS': {
            'context_processors': [
                # Insert your TEMPLATE_CONTEXT_PROCESSORS here or use this
                # list if you haven't customized them:
                'django.contrib.auth.context_processors.auth',
                'django.template.context_processors.debug',
                'django.template.context_processors.i18n',
                'django.template.context_processors.media',
                'django.template.context_processors.static',
                'django.template.context_processors.tz',
                'django.contrib.messages.context_processors.messages',
                'django.core.context_processors.request',
            ],
            'loaders': [
                ('shpaml.Loader',
                    ('django.template.loaders.filesystem.Loader',)
                ),  
                'django.template.loaders.filesystem.Loader',
                'django.template.loaders.app_directories.Loader',  
            ],
            'debug': False,
        },
    },
]
            
dm-coding commented 7 years ago

OP, did you ever discover a solution?

montythreecard commented 5 years ago

Yes. By using SHPAML in the project as an app (and adding it to the apps in the settings), and REMOVING it from the site-packages with PIP, it then works ok.

bschuon commented 4 years ago

Finally realized that you need to pip install django-shpaml, NOT pip install shpaml. And remove the old shpaml if installed. then everything is fine.