virtualenv和django的其他库 [英] virtualenv and additional libraries for django

查看:52
本文介绍了virtualenv和django的其他库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为我现有的Django项目设置了virtualenv.到目前为止,它仅使用django,但现在我尝试安装Pisa软件包.它已通过virtualenv中的pip成功安装,但是当我尝试在django shell中导入其软件包时,我得到了

I've setup a virtualenv for my existing Django project. So far it only uses django, but now I've tried to install Pisa package. It was installed successfully with pip in virtualenv, but when I try to import its package in django shell I get

没有名为ho.pisa的模块

No module named ho.pisa

到目前为止,我还没有找到解决这个问题的方法,而且对于其他人来说似乎没有这样的问题.

So far I've not found a solution to this problem, moreover there seems to be no such problems for other people.

您能帮我吗?

好吧,似乎添加以下内容就足够了:

Edited: Well, it seems that it is sufficient to add:

import site
vepath = '/path_to_ve_created_for_the_project/lib/python2.6/site-packages'

# add the site-packages of our virtualenv as a site dir
site.addsitedir(vepath)

它有效.但是,这是最干净的方法吗?

And it works. However, is this the cleanest way of doing this?

推荐答案

好吧,添加以下内容就足够了:

Well, it seems that it is sufficient to add:

import site
vepath = '/path_to_ve_created_for_the_project/lib/python2.6/site-packages'

# add the site-packages of our virtualenv as a site dir
site.addsitedir(vepath)

它有效.但是,这是最干净的方法吗?

And it works. However, is this the cleanest way of doing this?

这篇关于virtualenv和django的其他库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆