DEV Community

Discussion on: Customizing Django Authentication using AbstractBaseUser

Collapse
 
cubacasas profile image
Cuba Casas

The following will not work
'DIRS': [os.path.join(BASE_DIR, 'templates')],

And I don't know why. But it doesn't work. It produce the very famous (and infamous)
TemplateDoesNotExist at /

That nobody in Stackoverflow has solved yet.

The correct syntax is

'DIRS': ['userproj/templates'],

I don't know if this issue is a version problem or the fact I'm testing the app under Windows. But the above doesn't work and it would be great if someone explained why.

Collapse
 
davishek7 profile image
Avishek Das

You need to import os module on top of your settings file for that line to work.

Collapse
 
gaurav065 profile image
Gaurav Patel

you dont need to this just do DIRS:['templates'] or whatever the name of the folder is in the settings.py file. and instead of complicating stuff i would suggest you to just keep the templates folder outside and just make sub folders inside the templates and use them instead. Rest is up to you