Okay, so I fixed everything with Django Logging- including getting the
pictures to show up in the store.

However, one thing still remains - recognizing the *store/cart.html* and
*store/checkout.html*

To get the pictures to appear from the DJANGO ADMINISTRATION, I used the
following:


urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('store.urls')),
    url(r'^images/(?P<path>.)$', serve,{'document_root':
settings.MEDIA_ROOT}),
    url(r'^static/(?P<path>.)$', serve,{'document_root':
settings.STATIC_ROOT}),


]

I also tested this to get the *cart.html* and *checkout.html* to stop
showing a TemplateDoesNotExist 500 Server Error:


urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('store.urls')),
    url(r'^images/(?P<path>.)$', serve,{'document_root':
settings.MEDIA_ROOT}),
    url(r'^static/(?P<path>.)$', serve,{'document_root':
settings.STATIC_ROOT}),
    url(r'^cart/(?P<path>.)$', serve,{'document_root':
'/store/templates/store'}),
    url(r'^checkout/(?P<path>.)$', serve,{'document_root':
'/store/templates/store'}),


]

But still no success. Any suggestions?



On Wed, Sep 2, 2020 at 6:07 PM Kasper Laudrup <[email protected]> wrote:

> Hi King Niko,
>
> On 02/09/2020 17.46, King Niko wrote:
> > *I have not managed to get the Django log up and running, but this may
> > help to get guidance on resolving the issue:*
> >
>
> You should get access to the Django log. It's pointless to waste time on
> guessing what might be wrong when you could have a log file pointing you
> to exactly the line of code which is the cause of your error.
>
> Anyway, regarding your code:
>
> >      try:
> >          cart = json.loads(request.COOKIES['cart'])
> >      except:
>
> Only catch the exceptions you actually expect to be thrown and know how
> to handle. Catching all potential exceptions like you're doing here will
> potentially silence a lot of errors making it much harder for you to
> debug any issues that might occur later on because you ignored the
> original error.
>
> >          except:
> >              pass
>
> This is even more problematic. Here you are simply ignoring any
> exceptions that might be thrown again making it extremely hard to debug
> since you'll just get exceptions or "weird" behavior later on.
>
> Instead of trying to guess what might be wrong, you're lucky enough to
> be using an interpreted language (Python) that can give you some very
> precise error messages if you stop ignoring the errors and get access to
> the logs which will show exactly what went wrong.
>
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/76612162-ff10-06ea-84e5-8a52a31e45e6%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAO1EWpH4pQwLMyyF15uCFJCTGJanRdnWcb2bhvrnhnFx1mP%2BVA%40mail.gmail.com.

Reply via email to