N3TC4t N3TC4t - 20 days ago 5
Python Question

Django user permissions not showing in production

I have a weird problem. In production I can't see the user permissions list in Django admin and after opening the group edit page it shows nothing and page language transforms to another language.

I have some custom permission defined in app models.

What I have done:


  1. Sync my local database with production database.

  2. Setting default encoding in supervisor (I thought maybe if my app verbose name is a Unicode name so that's why it won't load)



I'm using Django version 1.7.

Update: It looks like the problem is from gunicorn or supervisord because it's working in direct runserver.

Answer

Problem was from os default encoding , I had some unicod permission names in my table and it's wont load and error happened .

so I just add this three line in my wsgi.py

import sys
reload(sys)
sys.setdefaultencoding('utf8')
Comments