Shopify Python Django "expected string or bytes-like object" error.

Shopify Partner
9 0 0

I am using PythonAPI for Django.

my code is:

def shopify_admin_home(request):
    products = shopify.Product.find(limit=3)
    data = {
        'products': products
    return render(request, 'shopify_admin/home.html', data)

When I run the "runserver" this view displays the product data only the first time.
When I reload the URL/page, it throws an error "expected string or bytes-like object". What I should do?

But, If directly run it with python console it works fine every time I call the data. I am really blocked. Give me a solution. Thanks all.

Reply 1 (1)
4 0 1

Old question, but I had a similar problem, not in Django, because I was using environment variables for my api keys. The environment variables weren't being used in certain situtations. Maybe in Django settings to have to set environment variables.