3

I have the following code that works perfectly fine in my local development environment, but when I use the same on the project dev server I get a KeyError: 'CONTENT_TYPE'

views.py:

if request.META['CONTENT_TYPE'] == 'text/plain':
    context = {}
    context['All'] = {'total': Theme.objects.all().count(), 'id': 0}

    for t in ThemeCategory.objects.all():
        context[t.categoryName] = {'total': t.theme_set.count(), 'id': t.id}
    context = collections.OrderedDict(sorted(context.items()))
    if request.user.is_anonymous():
        token = "false"
    else:
        token = get_json_web_token(request.user)

This is deployed in EC2 server with help of gunicorn and only getting error by running through gunicorn but by running in localhost it works.
What could be the issue here?

Any help is appreciated.

Ulf Gjerdingen
  • 1,414
  • 3
  • 16
  • 20
Coeus
  • 2,385
  • 3
  • 17
  • 27

0 Answers0