Skip to content

Hamlpy on django 1.11 uses the standard django-templates instead hamlpy #173

@Sanshain

Description

@Sanshain

I tried to start hamlpy by django 1.11 python 2.7.16. The package was installed 'pip install hamlpy' and followed instructions for setting.

Settings of project:

INSTALLED_APPS = [

    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    'django.contrib.sites',                                                     ##

    'hamlpy',
    'testapp',
]


TEMPLATE_LOADERS = (

    'hamlpy.template.loaders.HamlPyFilesystemLoader',
    'hamlpy.template.loaders.HamlPyAppDirectoriesLoader',

    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',

)

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [TEMPLATE_DIR,],
##        'APP_DIRS': True,
        'OPTIONS': {
            'loaders': TEMPLATE_LOADERS,
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

my view:

haml = lambda request: render(request,"test.haml",{})

my test.haml:

#profile
    .left.column
        #date 2010/02/18
        #address Toronto, ON
    .right.column
        #bio Jesse Miller {{user}}

the result page output is one line:

#profile .left.column #date 2010/02/18 #address Toronto, ON .right.column #bio Jesse Miller AnonymousUser

It meens, template has displayed as usually django-template.

I tried to understand why and visit to loaders.py. I discovered for myself that load_template_source is never be called by rendering test.haml and be rendered by integrated in django standart loaders.

I cann't find the answers why

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions