Odoo开发之macOS 开发环境安装配置教程

简单介绍一下Odoo在macOS上的开发环境配置,用到的工具有homebrew,pycharm,postgresapp

安装python
不推荐使用系统自带的python,避免权限或污染系统lib,所以我们用homebrew安装一个2.7,并使用virtualenv创建环境。
首先安装homebrew (http://brew.sh/index_zh-cn.html)

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install python
最新python3.7.x

更多brew使用技巧 请参考 http://pycave.com/2016/12/mac-homebrew/

安装数据库
也可以用brew或者使用官方的pkg,我们这里使用一个新出的专门为mac提供的postgresql安装包
具体安装使用方法请参考
http://pycave.com/2016/12/postgresapp-for-mac/

create user "odoo" with password 'odoo' createdb;
安装odoo
git下载

git clone https://www.github.com/odoo/odoo --depth 1 --branch 10.0 --single-branch odoo10

我们为每个项目单独复制一份odoo源码目录,方便我们开发。
创建venv,安装python依赖

pip install virtualenv
virtualenv venv
source venv/bin/activate
安装odoo依赖
pip install -r requirements.txt
安装pg报错

添加Postgres.app path

PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin
安装pillow报错

The headers or library files could not be found for jpeg,
a required dependency when compiling Pillow from source.

brew install libjpeg
另外可以到 https://pypi.org/project/Pillow/#history 下载whl版本安装

odoo配置文件
openerp-server.conf (从debian目录复制出来)

[options]
; This is the password that allows database operations:
; admin_passwd = admin
db_host = 127.0.0.1
db_port = 5432
db_user = odoo
db_password = odoo
addons_path = addons

> 若出现无法创建数据库, 请将admin_passwd 选项注释打开

运行odoo服务器
#odoo8
python odoo.py -c openerp-server.conf
#odoo10
python odoo-bin -c odoo.conf
安装配置开发工具
用pycharm打开项目
配置run button,见视频操作

> 注意 odoo9开始的版本需要安装nodejs,安装完成后请重启pycharm进程。

brew install node
npm install -g less less-plugin-clean-css
odoo12开始已经不用安装node了

常见错误
Database restore error: Command `pg_restore` not found.
https://postgresapp.com/documentation/cli-tools.html

原文链接: https://www.erpdaxue.cn/odoo/odoo教程/odoo-macos-开发环境安装配置/

posted @ 2020-03-15 18:15  odoo开发者  阅读(1108)  评论(0编辑  收藏  举报