人人可以学Python我爱编程

OSRoom安装教程

2018-05-24  本文已影响127人  HiWoo

环境要求

操作系统

Pyhotn要求

Pyhton依赖包安装

创建Python虚拟环境(建议)

pip -m venv /home/work/venv-osroom

sudo apt-get install python-venv

安装依赖包

    source /home/work/venv-osroom/bin/activate
    # 或
    . /home/work/venv-osroom/bin/activate

-进入osroom项目根目录

pip install -r requirements.txt

  # 不一定需要版本号
 sudo yum install python3.5-devel

配置数据库

安装

初始化配置

因为osroom源代码只把配置文件config.py 和 数据库配置文件db_config.py 的sample文件上传到git,所以请先复制修改名称

 # 进入到apps/configs
 cp config_sample.py config.py
 cp db_config_sample.py db_config.py
<br/><br/>  ```
 - 编辑db_config.py, 在配置中对应位置填写好数据库用户名和密码
<br/>
```python
 DB_CONFIG = {
    "redis": {
        "password": "<Your password>",
        "host": [
            "127.0.0.1"
        ],
        "port": [
            "6379"
        ]
    },
    "mongodb": {
        "mongo_web": {
            "password": "<Your password>",
            "username": "work",
            "config": {
                "fsync": False,
                "replica_set": None
            },
            "host": [
                "127.0.0.1:27017"
            ],
            "dbname": "osr_web"
        },
        "mongo_user": {
            "password": "<Your password>",
            "username": "work",
            "config": {
                "fsync": False,
                "replica_set": None
            },
            "host": [
                "127.0.0.1:27017"
            ],
            "dbname": "osr_user"
        },
        "mongo_sys": {
            "password": "<Your password>",
            "username": "work",
            "config": {
                "fsync": False,
                "replica_set": None
            },
            "host": [
                "127.0.0.1:27017"
            ],
            "dbname": "osr_sys"
        }
    }
}

初始化第一个用户

(venv_osroom) work@osroom:~/project/osroom$ python start.py add_user
 * [User] add
Input username:root
Input email:xiaopingwoo@163.com
Input password(Password at least 8 characters):
[Warning]: 密码至少8个字符! 至少包含数字,字母,特殊字符中的任意两种

Input password(Password at least 8 characters):
 * Create root role...
Create root user role successfully
 * Create root user...
 * Create a root user role successfully
 * Create the average user role...
 * Create a generic user role successfully
The basic information is as follows
Username: root
Email: h*****irr@***.com
User role: Root
Password: #D****qw123
End

访问测试

使用自带的服务测试是否能够成功运行osroom(测试用, 实际部署产品不会使用该方式启动运行)

启动OSROOM

# 如果需要外部访问,--host 为0.0.0.0 , --port 指定已开放的端口,默认5000
python start.py runserver --host 127.0.0.1 --port 5000

上一篇下一篇

猜你喜欢

热点阅读