Sunday, August 30, 2020

Re: 500 Server Error | Impossible to Fix

Okay, so I added a logging to:

> python manage.py runserver

And I found the error (which also now appears in "heroku logs --tail"). Interestingly, this thing states that:

> django.template.exceptions.TemplateDoesNotExist: store/main.html

This is impossible because in  urls.py I have my main as my base url: 

> urlpatterns = [
     path('  ' , views.main, name="main")
]

Also, in views.py I have main instantiated as:

def main(request):
    
    data= cartData(request)

    items=data['items']
    order=data['order']
    cartItems=data['cartItems']

    context = {'items':items, 'order':order, 'cartItems':cartItems}
    return render(request, 'store/main.html', context)

 
Thus I am confused as to how the Template could be non-existent if it does in fact exist. Would you all happen to know of any solutions to this?


On Sun, Aug 30, 2020 at 9:17 AM RANGA BHARATH JINKA <bharathjinka09@gmail.com> wrote:
Hi, 

    Please check the whole log errors line by line. Then only u can find the exact error

On Sun, Aug 30, 2020 at 6:37 PM King Niko <thelegendofearthreturns@gmail.com> wrote:
Hi Ranga, 

These are the last two log errors:

> "GET / HTTP/1.1" 500 145 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/ - (KHTML, like Gecko) Chrome/ - Safari/ -"

> at=info method=GET path="/" host=samplesite.herokuapp.com request_id=private fwd="private" dyno=web.1 connect=1ms service=116ms status=500 bytes=477 protocol=https

Thanks Ranga!

On Sun, Aug 30, 2020 at 8:33 AM RANGA BHARATH JINKA <bharathjinka09@gmail.com> wrote:
Hi,

   Copy and paste your log errors . I will check once

On Sun, Aug 30, 2020 at 5:23 PM King Niko <thelegendofearthreturns@gmail.com> wrote:
Thanks for the suggestion Kasper.
Unfortunately I have not been able to resolve the above bugs utilizing the recommended logging technique. The:

> heroku logs —tail 

Works to give me the errors mentioned previously. I just wish that there was a way for heroku itself to provide more detailed and precise 500 server errors. The current logs for Heroku is not informative enough. 

On Sat, Aug 29, 2020 at 15:19 Kasper Laudrup <laudrup@stacktrace.dk> wrote:
Hi King Niko,



On 29/08/2020 20.31, King Niko wrote:

>

> Both of these errors are very vague and provide no direction for

> resolution. Has anyone ever encountered this before?

>



I don't know anything about deploying on Heroku, but as others have

pointed out, you should definitely look into how to get some more

detailed log information:



https://docs.djangoproject.com/en/3.1/topics/logging/



I've personal set up my logging so I get an email with detailed

information in case of an internal server error. That works quite well

for my use case, but yours might be very different.



There's no reason wasting time trying to guess what is wrong, you want

to be able to get hold of the detailed error information sooner or later

anyway so start by figuring out how you can do that as the very first thing.



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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/840b420f-9457-f173-87e7-bad43b3b4d92%40stacktrace.dk.

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAO1EWpF1ZZR9ok3YHxmpcV23r6%2BPrW8Q2V_%3DE1aTJCqMn%3DFShg%40mail.gmail.com.


--
Thanks and Regards

J. Ranga Bharath
cell: 9110334114

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK5m317Q7rWCgPRXV%3Df2ai3HKzvsvGCUkJ3v%3DsrkUEV678pcXA%40mail.gmail.com.

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAO1EWpFcfDpeowV5aJ2jA2%3DDSsU-k05bA6siLxeU1P4wTS3nCw%40mail.gmail.com.


--
Thanks and Regards

J. Ranga Bharath
cell: 9110334114

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK5m314mNdr9ia4gJLzPLRnTybGWRT20EvZnVCpy1LZHLUp4qw%40mail.gmail.com.

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAO1EWpFAB%2B3X3STwp5BoYD%2BjBbqrqOHW9KOoLUYRoXe-JL7B6A%40mail.gmail.com.

No comments:

Post a Comment