def index():
with open('templates/index.html', encoding='utf-8') as template:
return template.read()def index():
with open(r'templates\index.html', encoding='utf-8') as template:
return template.read()def index():
with open('templates\\index.html', encoding='utf-8') as template:
return template.read()open(os.path.join(os.path.dirname(__file__),'templates/index.html') все работает нормально, но вопрос в том, почему на видео без этого все норм, а у меня ошибки? os.path, но вопрос в том, почему у автора видео без использования этих функций относительные пути нормально работают, а у меня выполнение кода как на видео валится с ошибкой FileNotFoundError: [Errno 2] No such file or directory: 'templates/index.html' 
def index():
with open('templates/index.html', encoding='utf-8') as template:
return template.read()
Результат один и тот же - FileNotFoundError: [Errno 2] No such file or directory: 'templates\\index.html', либо FileNotFoundError: [Errno 2] No such file or directory: 'templates/index.html'
С указанием абсолютного пути или использованием все работает нормально, но вопрос в том, почему на видео без этого все норм, а у меня ошибки?