简体   繁体   English

Django用户权限未在生产中显示

[英]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. 在生产中,我无法在Django管理员中看到用户权限列表,在打开组编辑页面后,它没有显示任何内容,页面语言转换为另一种语言。

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) 在supervisor中设置默认编码(我想如果我的app详细名称是Unicode名称,那就是为什么它不会加载)

I'm using Django version 1.7. 我正在使用Django 1.7版。

Update: It looks like the problem is from gunicorn or supervisord because it's working in direct runserver. 更新:看起来问题来自gunicorn或supervisord,因为它在直接运行服务器中工作。

Problem was from os default encoding , I had some unicode permission names in my records and it's wont load and error happened . 问题是来自os默认编码,我的记录中有一些unicode权限名称,它不会加载并发生错误。

so I just add this three line in my wsgi.py 所以我只在我的wsgi.py中添加这三行

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM