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-開發環境安裝配置/


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM