open-falcon 前端代码在windows上运行
1: 下载代码git clone https://github.com/open-falcon/dashboard.git
2:在代码\dashboard-0.2.0 的根目录下安装 python虚拟环境
windows下安装python虚拟环境略;
C:\home\myworkspace\mypython\dashboard-0.2.0> //进入项目根目录
mkvirtualenv -p //生成虚拟环境操作
C:\_____Soft______\python2.7.14\python.exe //指定安装版本
C:\home\myworkspace\mypython\dashboard-0.2.0\env //指定虚拟环境生成目录,
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
这样就可以在dashboard-0.2.0目录下生成一个env的python版本为2.7的虚拟环境
C:\home\myworkspace\mypython\dashboard-0.2.0>mkvirtualenv -p C:\_____Soft______\python2.7.14\python.exe C:\home\myworkspace\mypython\dashboard-0.2.0\env
3:进入虚拟环境//
在C:\home\myworkspace\mypython\dashboard-0.2.0\env\Scripts 目录下有个activate 直接运行
这时就会显示(env)
(env) C:\home\myworkspace\mypython\dashboard-0.2.0>
4:开始安装pip_requirements.txt里面的包
(env) C:\home\myworkspace\mypython\dashboard-0.2.0> pip install -r pip_requirements.txt
如果报错
----------------------------------------
Failed building wheel for mysql-python
----------------------------------------
Failed building wheel for python-ldap
//开始下载
//https://www.lfd.uci.edu/~gohlke/pythonlibs/#python-ldap
//https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python
两个文件
并放在C:\home\myworkspace\mypython\dashboard-0.2.0\env
然后执行,pip install 这个两个文件;
(env) C:\home\myworkspace\mypython\dashboard-0.2.0\env>pip install python_ldap-2.5.2-cp27-cp 27m-win_amd64.whl Processing C:\home\myworkspace\mypython\dashboard-0.2.0\env\python_ldap-2.5.2-cp27-cp27m-win_amd64.whl Requirement already satisfied: setuptools in C:\home\myworkspace\mypython\dashboard-0.2.0\env\lib\site -packages (from python-ldap==2.5.2) (39.0.1) Installing collected packages: python-ldap Successfully installed python-ldap-2.5.2 (env) C:\home\myworkspace\mypython\dashboard-0.2.0\env>pip install MySQL_python-1.2.5-cp27-n one-win_amd64.whl Processing C:\home\myworkspace\mypython\dashboard-0.2.0\env\mysql_python-1.2.5-cp27-none-win_amd64.whl Installing collected packages: MySQL-python Successfully installed MySQL-python-1.2.5
这时候需要再次运行(env) C:\home\myworkspace\mypython\dashboard-0.2.0> pip install -r pip_requirements.txt
安装成功;
5:(env) C:\home\myworkspace\mypython\dashboard-0.2.0>python wsgi.py
这时候需要更改一些配置文件,因为这套代码基于linux开发的,linux 下的python虚拟环境不同于windows的目录结构因此需要改
wsgi.py文件
将activate_this = '%s/env/bin/activate_this.py' % base_dir 改为activate_this = '%s/env/Scripts/activate_this.py' % base_dir
ok!!