And*_*w C 3 python django 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__'
Run Code Online (Sandbox Code Playgroud)
在我的开发环境中,我没有这个问题.我将我的python路径设置为包含django-piston目录.在生产时,我通过将活塞编译为rpm(python setup.py bdist --format=rpm)并将其安装为鸡蛋来安装活塞/usr/lib/python2.6/site-packages/.这意味着在开发中,我可以做到
>>> import piston
>>> piston.__file__
/some/file/path/here
Run Code Online (Sandbox Code Playgroud)
但是在生产上我得到了
>>> import piston
>>> piston.__file__
AttributeError: 'module' object has no attribute '__file__'
Run Code Online (Sandbox Code Playgroud)
有没有人知道这方面的方法?
看起来这是Piston 0.2.3的一个已知问题.您可以应用此修补程序或仅使用版本0.2.2安装它:
pip install django-piston==0.2.2
Run Code Online (Sandbox Code Playgroud)