将 django 应用程序打包为 python Egg 以便与 django 管理文档一起使用
我已经接管了一个 django (1.1) 项目,该项目有许多 django 应用程序作为 Egg 安装(在 /usr/lib/python2.6/site-packages/ 中)。除了 django 管理文档之外,这在任何地方都可以正常工作。 查看标签或过滤器的文档让我感到困惑:
File "/usr/lib/python2.6/site-packages/Django-1.1.1-py2.6.egg/django/contrib/admindocs/views.py" in load_all_installed_template_libraries
313. libraries = [os.path.splitext(p)[0] for p in os.listdir(e) if p.endswith('.py') and p[0].isalpha()]
Exception Type: OSError at /admin/doc/tags/
Exception Value: (20, 'Not a directory')
尝试在此处
e = '/usr/lib/python2.6/site-packages/django_tinymce-1.5-py2.6.egg/tinymce/templatetags'
基本上 django 管理文档无法自动加载鸡蛋,因为它们是 zip 存档,而不是目录。
做了一些搜索后,我认为我的选择是:
- 将鸡蛋解压到位
- 适应 http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#using-eggs-with-mod-python (我正在使用 mod_wsgi)
- 黑客攻击正确处理 Egg 的 django admindocs 代码
可能并不困难,但在生产服务器上没有一个完全有吸引力。 还有其他人处理过这个吗?你会推荐什么?
i've taken over a django (1.1) project which has a number of django apps installed as eggs (in /usr/lib/python2.6/site-packages/). This works fine everywhere except for the django admin docs. Trying to view the docs for tags or filters here gets me:
File "/usr/lib/python2.6/site-packages/Django-1.1.1-py2.6.egg/django/contrib/admindocs/views.py" in load_all_installed_template_libraries
313. libraries = [os.path.splitext(p)[0] for p in os.listdir(e) if p.endswith('.py') and p[0].isalpha()]
Exception Type: OSError at /admin/doc/tags/
Exception Value: (20, 'Not a directory')
where
e = '/usr/lib/python2.6/site-packages/django_tinymce-1.5-py2.6.egg/tinymce/templatetags'
so basically the django admin docs can't auto load the eggs because they are zip archives, not directories.
having done some searching i think my options are:
- unpack the eggs in place
- adapt http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#using-eggs-with-mod-python (i'm using mod_wsgi)
- hacking the django admindocs code to deal properly with eggs
none of these are probably really difficult but none are exactly appealing on a production server.
has anyone else dealt with this? what would you recommend?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否确实为 Egg 缓存目录指定了 Apache 正在运行您的代码的用户可写的目录。
http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Access_Rights_Of_Apache_User
Have you actually specified a directory writable by user that Apache is running your code, for the egg cache directory.
http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Access_Rights_Of_Apache_User