Hello
Hello

Reputation: 57

Django Endless Pagination : 500 INTERNAL SERVER ERROR on Twitter-style Pagination

So I've been following this tutorial on this amazing app: http://django-endless-pagination.readthedocs.org/en/latest/twitter_pagination.html#twitter-page-template

I went through, modified the views.py part to fit mine:

@login_required
@page_template('stories/index_story.html')
def index(request, extra_context=None):
story_list = Story.objects.order_by("-date_published")

#FORM
form = StoryForm(initial={'writer': request.user.userprofile, 'date_published': timezone.now()}) ### REMEMBER THIS !!!

template = 'stories/index.html'
page_template = 'stories/index_story.html'

context = {'stories': story_list, 'form': form, 'page_template': page_template}

if extra_context is not None:
    context.update(extra_context)

return render(request, template, context)

Fired up the server. Everything looked fine, but when I clicked on 'more' it turns into 'loading' and nothing happended.

I got the error from the console:

GET http://127.0.0.1:8000/stories/?page=2&querystring_key=page 500 (INTERNAL SERVER ERROR)

I actually navigated to http://127.0.0.1:8000/stories/?page=2&querystring_key=page and it loaded the other sets of posts.

What is happening?

Upvotes: 3

Views: 440

Answers (1)

boxeus
boxeus

Reputation: 394

I have the same problem, and in my case it was a very simple solution - the name of page_template was misspelled, so django could not found it, and gives me 500 error.

Upvotes: 1

Related Questions