Why have we use real path for override Oscar templates

32 views
Skip to first unread message

YusufSalahAdDin

unread,
Aug 15, 2016, 4:29:18 PM8/15/16
to django-oscar

Hi guys, i have a question:

For override templates we have two options, but both use these settings:

location = lambda x: os.path.join(os.path.dirname(os.path.realpath(__file__)), x)


'DIRS': [
# os.path.join(BASE_DIR, 'templates'),
location('templates'),
OSCAR_MAIN_TEMPLATE_DIR,
],

Normally will be enough with this:
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

'DIRS': [
os.path.join(BASE_DIR, 'templates'),
# location('templates'),
OSCAR_MAIN_TEMPLATE_DIR,
],

And add a template folder inside app project.

I have a big organization problem with Oscar's way:

I have a three setting file.

With the Oscar's way i have this template dir:

So, because this the tempĺate isn't loaded correctly. I have put templates folder inside settings folder for they loader successfully.

Normally is enough add a folder with the apps name, in this case Oscar, and inside struct the templates like the package templates structure:



But, in this case, Oscar can not load my custom template:


Finally, i choose make template structure as Oscar's way template path ask me:
 


And works fine:


So, why handled Oscar templates in thiw way instead use default django template handlers?

Thanks guys!

Reply all
Reply to author
Forward
0 new messages