Search code examples
djangodjango-endless-pagination

django endless pagination not working in production but works in development


i am using django-endless-pagination with twitter style for my website and it works perfectly fine in development but when i move to production it is not even showing the entries. I am using webfaction and below is the list of actions i have taken.

1) PYTHONPATH=$HOME/webapps/csiop/lib/python2.7 easy_install-2.7 --install-dir=$HOME/webapps/csiop/lib/python2.7 --script-dir=$HOME/webapps/csiop/bin django-endless-pagination 2) python manage.py syncdb 3) Add endless_pagination to settings.py and below also in settings.py

 PAGINATION_SETTINGS = {
  'PAGE_RANGE_DISPLAYED': 10,
  'MARGIN_PAGES_DISPLAYED': 2,
 }

4) My views.py is changed to look like below

   def homepage(request):
       item_list = items.objects.filter(show_on_website=True)
       template = 'homepage.html'
       page_template = 'home_page_index.html'

       if request.is_ajax():
             template = page_template

       return render_to_response(template,
         {'page_template': page_template,
         'item_list': item_list},
       context_instance=RequestContext(request))

5) And my templates are slipt as below.

Homepage.html:-

    <h2>Entries:</h2>
    {% include page_template %}

    {% block js %}
       {{ block.super }}
       <script src="http://code.jquery.com/jquery-latest.js"></script>
       <script src="{{ STATIC_URL }}endless_pagination/js/endless-pagination.js"></script>
       <script>$.endlessPaginate();</script>
    {% endblock %}

home_page_index.html:-

   {% load endless %}

   {% lazy_paginate entries %}
      {% for entry in entries %}
        {# your code to show the entry #}
      {% endfor %}
   {% show_more " " %}

the above code works perfectly fine in my development but not in production. Could someone help what i am missing ?

Edit : - if i set the debug mode to False in my development environment i am getting the below error. I am using django-seo as well in website, it seems to be complaining about that but i am not really sure what the error exactly realtes to.

  Traceback (most recent call last):
  File            "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/handlers.py", line 85, in run
  self.result = application(self.environ, self.start_response)
  File "/Users/django1.5/django1.5_ve/lib/python2.7/site-  packages/django/core/handlers/wsgi.py", line 255, in __call__
  response = self.get_response(request)
  File "/Users/django1.5/django1.5_ve/lib/python2.7/site-packages/django/core/handlers/base.py", line 178, in get_response
  response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
  File "/Users/django1.5/django1.5_ve/lib/python2.7/site-packages/django/core/handlers/base.py", line 224, in handle_uncaught_exception
  return callback(request, **param_dict)
  File "/Users/django1.5/django1.5_ve/lib/python2.7/site-packages/django/utils/decorators.py", line 91, in _wrapped_view
  response = view_func(request, *args, **kwargs)
  File "/Users/django1.5/django1.5_ve/lib/python2.7/site-packages/django/views/defaults.py", line 41, in server_error
   return http.HttpResponseServerError(template.render(Context({})))
   File "/Users/django1.5/django1.5_ve/lib/python2.7/site-packages/django/template/base.py", line 140, in render
   return self._render(context)
   File "/Users/django1.5/django1.5_ve/lib/python2.7/site-packages/django/template/base.py", line 134, in _render
   return self.nodelist.render(context)
   File "/Users/django1.5/django1.5_ve/lib/python2.7/site-packages/django/template/base.py", line 830, in render
   bit = self.render_node(node, context)
   File "/Users/django1.5/django1.5_ve/lib/python2.7/site-packages/django/template/base.py", line 844, in render_node
   return node.render(context)
   File "/Users/django1.5/django1.5_ve/lib/python2.7/site-packages/django/template/loader_tags.py", line 124, in render
   return compiled_parent._render(context)
   File "/Users/django1.5/django1.5_ve/lib/python2.7/site-packages/django/template/base.py", line 134, in _render
   return self.nodelist.render(context)
   File "/Users/django1.5/django1.5_ve/lib/python2.7/site-packages/django/template/base.py", line 830, in render
   bit = self.render_node(node, context)
   File "/Users/django1.5/django1.5_ve/lib/python2.7/site-packages/django/template/base.py", line 844, in render_node
   return node.render(context)
   File "/Users/django1.5/django1.5_ve/lib/python2.7/site-packages/rollyourown/seo/templatetags/seo.py", line 25, in render
   raise template.TemplateSyntaxError(msg)
   TemplateSyntaxError: {% get_metadata %} needs some path information.
    Please use RequestContext with the django.core.context_processors.request context  processor.
    Or provide a path or object explicitly, eg {% get_metadata for path %} or {%        get_metadata for object %}
   [09/Apr/2013 18:22:49] "GET / HTTP/1.1" 500 59

Thanks


Solution

  • I have re-installed django-endless-pagination using pip rather than easy-install and it works fine now. Looks like the issue is because i installed with easy-install before without -Z before.