python – 使用egg模块时同步django-piston模型
作者:互联网
我正在使用django-piston并在运行manage.py syncdb命令时遇到以下问题:
Traceback (most recent call last):
File "./manage.py", line 13, in <module>
execute_manager(settings)
File "/home/appfirst/django/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
............ lines ommitted ...........
File "/home/appfirst/django/django/utils/translation/trans_real.py", line 176, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "/home/appfirst/django/django/utils/translation/trans_real.py", line 160, in _fetch
apppath = os.path.join(os.path.dirname(app.__file__), 'locale')
AttributeError: 'module' object has no attribute '__file__'
在我的开发环境中,我没有这个问题.我将我的python路径设置为包含django-piston目录.在生产时,我通过将它编译为rpm(python setup.py bdist –format = rpm)并将其作为鸡蛋安装在/usr/lib/python2.6/site-packages/中来安装活塞.这意味着在开发中,我可以做到
>>> import piston
>>> piston.__file__
/some/file/path/here
但是在生产上我得到了
>>> import piston
>>> piston.__file__
AttributeError: 'module' object has no attribute '__file__'
有没有人知道这方面的方法?
解决方法:
看起来这是活塞0.2.3的known issue.你可以通过安装它来申请this patch或只使用版本0.2.2:
pip install django-piston==0.2.2
标签:python,django,django-piston 来源: https://codeday.me/bug/20190723/1516349.html