要求:我期望后端项目1和后端项目2包之间互不干扰,请问应当如何做?
背景:项目2拥有公共解释环境没有的包,项目1可以正常访问,项目2提示没有包。
截图:
1:
项目1,wsgi文件如下
activate_this = r'D:\python_project\test_apache_001\venu\Scripts\activate_this.py'
with open(activate_this) as file_:
exec(file_.read(), dict(__file__=activate_this))
import sys
sys.path.insert(0, r'D:\python_project\test_apache_001')
from app import app as application
项目2wsgi文件如下
activate_this = r'D:\python_project\test_apache_002\venu\Scripts\activate_this.py'
with open(activate_this) as file_:
exec(file_.read(), dict(__file__=activate_this))
import sys
sys.path.insert(0, r'D:\python_project\test_apache_002')
from app import app as application
访问项目2,因为项目2拥有一个特别的包,故报错,请问如何设置每个项目都使用自己的虚拟环境,互不干扰?