benyrey
Posts: 67
Joined: Tue Aug 19, 2014 7:52 pm

.py program run many times, not anymore. Please

Sat Oct 12, 2019 3:34 pm

I run my .py program many times, it always worked.
But now that I have a new internet service provider with a different router
(which I port forwarded) the same program does NOT run. My program is a web
server it uses this line:
return render_template('main.html', **templateData)
I always get the following error:
“TemplateNotFound: main.html”.
BTW, I am using a new Raspberrypi 3 B+. I do not believe
that it is the problem.
Please help me. Thanks
Beny

User avatar
neilgl
Posts: 1187
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: .py program run many times, not anymore. Please

Sat Oct 12, 2019 4:42 pm

In your new pi3 setup, using flask, have you created a folder with name “templates” in the same directory where the python file is located and put your main.html file in that templates folder?

benyrey
Posts: 67
Joined: Tue Aug 19, 2014 7:52 pm

Re: .py program run many times, not anymore. Please

Sat Oct 12, 2019 5:07 pm

A Templates folder was already created in the new RPi. It came with it. I just put there the same main.html
file that I used before.
Thanks a lot.
Beny

scotty101
Posts: 3750
Joined: Fri Jun 08, 2012 6:03 pm

Re: .py program run many times, not anymore. Please

Sat Oct 12, 2019 6:56 pm

Templates and templates are not the same thing. Once has an upper case first letter.

It has to be a lower case t.
In your Pi directory create a new folder, place your .py file inside there and create a new templates folder there too and place the .HTML file inside that.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

benyrey
Posts: 67
Joined: Tue Aug 19, 2014 7:52 pm

Re: .py program run many times, not anymore. Please

Sat Oct 12, 2019 10:10 pm

You are right... thanks a lot ... i don't know what to say else. Sorry about it.
In my new RPi 3 B+ I renamed the folder Templates as templates. Following your
input, the file main.html was setting in. It just works ... period.

But I am not happy with Raspberrypi 3 B+. My program worked perfect for one year using the
former RPi 3 B+ with the folder Template (with T) and the main.html file in it.

I am just confused. Hey Man ... thanks a lot. You have a good week end.
I will have some beers now.

My respects

Beny

Return to “Beginners”