TemplateDoesNotExist Error on deploying

120 views
Skip to first unread message

yingi keme

unread,
Jan 13, 2018, 7:46:28 AM1/13/18
to Django users
I tried deploying my app to pythonanywhere hosting service and i am getting

TemplateDoesNotExist Error

Everything seems to work out well with my development server. But its not working fine when hosting

Anyhelp please!!

Here is my View

def Home(request):
    template = 'Home\First.html'
    return render(request, template)

Kasper Laudrup

unread,
Jan 13, 2018, 8:51:23 AM1/13/18
to django...@googlegroups.com
Hi Yingi,
Avoid using backslashes ('\') in paths. Use a normal slash ('/') instead.

Not sure if that solves your problem, but it's a good idea anyway.

Backslashes are used for escaping characters in Python (and most other
languages).

Also, if you post the entire error message (not just the exception type)
it would be much easier to help you.

Kind regards,

Kasper Laudrup

yingi keme

unread,
Jan 13, 2018, 3:59:00 PM1/13/18
to django...@googlegroups.com
Thanks Kasper. It was the backslash.

Thanks for saving me...

Yingi Kem
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2d02cda2-6678-607a-87c0-d8a862a35ecd%40stacktrace.dk.
> For more options, visit https://groups.google.com/d/optout.

Jani Tiainen

unread,
Jan 13, 2018, 4:29:36 PM1/13/18
to django...@googlegroups.com
Hi,

Also be careful with file names. For example windows is case-preserving but case-insensitive. You may accidentally name your templates with different  casing which may lead difficult to spot problems. 

13.1.2018 22.58 "yingi keme" <ying...@gmail.com> kirjoitti:
Thanks Kasper. It was the backslash.

Thanks for saving me...

Yingi Kem

> On 13 Jan 2018, at 2:52 PM, Kasper Laudrup <lau...@stacktrace.dk> wrote:
>
> Hi Yingi,
>
>> On 2018-01-13 14:46, yingi keme wrote:
>> I tried deploying my app to pythonanywhere hosting service and i am getting
>> TemplateDoesNotExist Error
>> Everything seems to work out well with my development server. But its not working fine when hosting
>> Anyhelp please!!
>> Here is my View
>> def Home(request):
>>     template = 'Home\First.html'
>>     return render(request, template)
>
> Avoid using backslashes ('\') in paths. Use a normal slash ('/') instead.
>
> Not sure if that solves your problem, but it's a good idea anyway.
>
> Backslashes are used for escaping characters in Python (and most other languages).
>
> Also, if you post the entire error message (not just the exception type) it would be much easier to help you.
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.

> To post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2d02cda2-6678-607a-87c0-d8a862a35ecd%40stacktrace.dk.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

yingi keme

unread,
Jan 13, 2018, 5:06:38 PM1/13/18
to django...@googlegroups.com
Okk Jani. I will take note of that too..

Thanks

Yingi Kem
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
Reply all
Reply to author
Forward
0 new messages