You've used the literal path '/home/user/templates/'
. Unless your username is actually user
, there is no such directory, and therefore attempting to read the index
template out of that directory is going to fail.
If your username is, say, rhpt
, you'd change that to '/home/rhpt/templates/'
.
Even better, you might want to use os.path.expanduser('~/templates/')
instead of hardcoding your username. (Then you can give your code to a friend, or a client, and they can host it without having to edit the code.)