- Odoo 11 Development Cookbook(Second Edition)
- Holger Brunn Alexandre Fayolle
- 459字
- 2021-06-25 22:48:37
How to do it...
In order to use buildout to build your project, you need to follow these steps:
- On your development server, create a new work directory:
$ mkdir ~/odoo-dev/project-buildout $ cd ~/odoo-dev/project-buildout
- Create a file called buildout.cfg:
[buildout] parts = odoo [odoo] recipe = anybox.recipe.odoo:server OCA = https://github.com/OCA version = git https://github.com/odoo/odoo.git odoo 11.0 depth=1 addons = git ${odoo:OCA}/server-tools.git parts/server-tools 11.0 git ${odoo:OCA}/partner-contact.git parts/partner-contact 11.0 local local/addons options.limit_memory_hard = 4294967296 options.limit_memory_soft = 671088640 options.limit_request = 8192 options.limit_time_cpu = 120 options.limit_time_real = 300 options.http_port = 8069 options.longpolling_port = 8072 options.workers = 0 [versions] zc.buildout = 2.9.5
# you will need to update the following line
# once the version supporting Odoo 11.0 is known. # anybox.buildout.odoo = 1.9.1 setuptools = 19.7
setuptools = 19.7
Babel = 2.3.4
decorator = 4.0.10
docutils = 0.12
ebaysdk = 2.1.5
feedparser = 5.2.1
gevent = 1.1.2
greenlet = 0.4.10
jcconv = 0.2.3
html2text = 2016.9.19
Jinja2 = 2.8
lxml = 3.5.0
Mako = 1.0.4
MarkupSafe = 0.23
mock = 2.0.0
num2words = 0.5.4
ofxparse = 0.16
passlib = 1.6.5
Pillow = 3.4.1
psutil = 4.3.1
psycogreen = 1.0
psycopg2 = 2.7.1
pydot = 1.2.3
pyldap = 2.4.28
pyparsing = 2.1.10
PyPDF2 = 1.26.0
pyserial = 3.1.1
python-dateutil = 2.5.3
pytz = 2016.7
pyusb = 1.0.0
PyYAML = 3.12
qrcode = 5.3
reportlab = 3.3.0
requests = 2.11.1
six = 1.10.0
suds-jurko = 0.6
vatnumber = 1.2
vobject = 0.9.3
Werkzeug = 0.11.11
XlsxWriter = 0.9.3
xlwt = 1.3.0
xlrd = 1.0.0
- Create a configuration file for the production environment in prod.cfg:
[buildout] extends = buildout.cfg [odoo] options.limit_memory_hard = 4294967296 options.limit_memory_soft = 671088640 options.limit_request = 8192 options.limit_time_cpu = 120 options.limit_time_real = 300 options.workers = 4 options.data_dir = project/filestore options.http_interface = 127.0.0.1 options.http_port = 8069 options.longpolling_port = 8072 options.log_level = warn options.log_handler = :WARNING,werkzeug:CRITICAL,odoo.service.server:INFO options.admin_password = generate with pwgen -s 16 1 options.listdb = False options.db_host = False options.db_port = False options.db_user = False options.db_name = odoo_project options.dbfilter = ^odoo_project$ options.proxy_mode = True
- Create a configuration file for the development environment in dev.cfg:
[buildout] extends = buildout.cfg [odoo] options.db_name = odoo_dev options.dbfilter = ^odoo_dev$ options.log_level = info
- Create a virtualenv without setuptools:
$ virtualenv -p python3 sandbox --no-setuptools
- Download the current version of the bootstrap.py file:
$ wget https://raw.github.com/buildout/buildout/master/bootstrap/bootstrap.py
- Run the bootstrap.py script:
$ sandbox/bin/python3 bootstrap.py
- On your development machine, you can create a development environment by running the following:
$ bin/buildout -c dev.cfg
- On the production server, you can create a production environment by running
the following:
$ bin/buildout -c prod.cfg
- To start the instance, run the following:
$ bin/start_odoo
- Commit the files to Git (you may also want to add a .gitignore file):
$ git init $ git add buildout.cfg prod.cfg dev.cfg bootstrap.py local/addons $ git commit -m "initialize project with buildout"