app-generator / ecommerce-flask-stripe

Flask Stripe Sample - Soft UI Design (Free Sample) | AppSeed
https://blog.appseed.us/flask-stripe-open-source-mini-ecommerce/
Other
52 stars 31 forks source link

404 case for products #3

Closed app-generator closed 1 year ago

app-generator commented 1 year ago

If the user creates a product and later delete it, on access the server bumps ERR 500

image

Error log

127.0.0.1 - - [03/Nov/2022 15:41:47] "GET /static/assets/img/down-arrow-dark.svg HTTP/1.1" 304 -
    rv = self.handle_user_exception(e)
  File "D:\work\repo-free\ecommerce-flask-stripe\env\lib\site-packages\flask\app.py", line 1820, in full_dispatch_request
    rv = self.dispatch_request()
  File "D:\work\repo-free\ecommerce-flask-stripe\env\lib\site-packages\flask\app.py", line 1796, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "D:\work\repo-free\ecommerce-flask-stripe\app\views.py", line 122, in product_info
    product = load_product_by_slug( path )
  File "D:\work\repo-free\ecommerce-flask-stripe\app\util.py", line 103, in load_product_by_slug
    return load_product( aJSONPath )
  File "D:\work\repo-free\ecommerce-flask-stripe\app\util.py", line 69, in load_product
    f = open(aJSONPath, 'r')
FileNotFoundError: [Errno 2] No such file or directory: 'D:\\work\\repo-free\\ecommerce-flask-stripe\\app\\templates\\products\\django-black-pro.json'
127.0.0.1 - - [03/Nov/2022 15:41:55] "GET /products/django-black-pro/ HTTP/1.1" 500 -
app-generator commented 1 year ago

Fixed.