I'm using django-piston and running into the following problem when running the manage.py syncdb command:
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__'
In my development environment, I don't have this problem. There I have my python path set to include the django-piston directory. On production, I installed piston by compiling it to an rpm (python setup.py bdist --format=rpm
) and installing it as an egg in /usr/lib/python2.6/site-packages/
. This means that in development, I can do
>>> import piston
>>> piston.__file__
/some/file/path/here
But on production I get
>>> import piston
>>> piston.__file__
AttributeError: 'module' object has no attribute '__file__'
Does anyone know a way around this?
Looks like this is a known issue with Piston 0.2.3. You could apply this patch or just use version 0.2.2 by installing it as so:
pip install django-piston==0.2.2