Forums

First app. Can't find template.

Gentlepeople. I am trying to deploy an app on PA for the first time without success. The error I'm getting is: template does not exist, with the template in error being: /ftfeeds/home.html. The url is: http://acormond.pythonanywhere.com/ftfeeds. "ftfeeds" is the name of the application in my project.

I have created this application following the book "Tango With Django". I used PyCharm as my IDE. The app runs fine on PyCharm's internal server on my machine. I have followed the installation instructions in both the book and on the PA site in detail.

I am using python 2.7 and Django 1.5.5 in a virtual environment, which I set up according to the instruction above.

I'm lost. Any help would be most appreciated. I have made notes about what I did in detail; let me know if you want them. Assuming you work for PythonAnywhere you are welcome to examine my code and error logs. My account, which you can infer from the url, is "acormond".

Thanks Alex Ormond

Your most likely culprit is that your template search path didn't translate between your local install and your PythonAnywhere installation. Your TEMPLATE_DIRS Django setting points to /var/www/templates which suggests that your app is somehow using the working directory to find your templates instead of either a full path or a path related to the location of your files.

Thank you for your response Glenn. Responding to your suggestion I changed the PROJECT_PATH in settings.py to the full path of my project, '/home/acormond/projects/MorrisChallenge'. Since the single entry in TEMPLATE_DIRS is set to os.path.join(PROJECT_PATH, 'templates'), this resulted in a TEMPLATE_DIRS entry of "/home/acormond/projects/MorrisChallenge/templates", wherein lies the "ftfeeds" folder which contains "home.html". However, on trying to go to the site I still get error "TemplateDoesNotExist" with the template being "/ftfeeds/home.html". On the up side, I can get to acormond.pythonanywhere.com/admin.

Thanks again for your help.

Alex

It's probably the leading slash in /ftfeeds/home.html. The Django docs suggest that you should use a relative path when you're looking up a template.

That worked! Bless you lad.

You saved my day. 'DIRS': ['/home/bibinkunjumon2020/eventPlannerWeb/templates'],

if u have all your html files in template ,while hosting you have to make seetings file like tis

Glad to hear that you made it work!