Why pagination doesn't work? On the local server works, but not here. Here it does not work - Site

Here is the code:

def book_page(request, pk): # Get book i_book = get_object_or_404(Book, pk=pk) # Get book text book = i_book.full_text.split() # On 1 page words paginator = Paginator(book, settings.COUNT_WORDS) # Get page page = request.GET.get('page') # Check on int(page) if not isinstance(page, int): if isinstance(page, str) and page.isdigit(): page = int(page) pages = paginator.page(page) else: # if page != int -> open first page pages = paginator.page(1) return render(request, 'reader/view.html', {'book': i_book, 'pages': pages}) 
  • Is there also a third python on the server? - andreymal
  • @andreymal yes, #! / usr / bin / env python3 is written in all the files and the path to the packages is on Python3.4 - Roman Kravets
  • env means nothing, and “path to packages” is what is meant? - andreymal
  • @andreymal in wsgi configuration - sys.path.append ('/ home / x / x50609w8 / .local / lib / python3.4 / site-packages') - Roman Kravets
  • one
    Indeed, it looks like isinstance (page, str) returns false. try a more canonical solution docs.djangoproject.com/en/1.10/topics/pagination/… - ivan_susanin

0