launching Openerp 6.1 with gunicorn fails because it does not load addons

Asked by Esteban Díaz Asúa

Hello,

I have a problem launching Openerp with gunicorn, the issue is that it seems the addons directory is not read.

The command I use is gunicorn openerp:wsgi.core.application -c gunicorn.conf.py

That seems to launch a number of workers, but the contents on the conf file should lead it to the addons directory... however we get the dreaded no handler found... (see below, I even added an extra path, just in case).

# Gunicorn sample configuration file.
# See http://gunicorn.org/configure.html for more details.
#
# To run the OpenERP server via Gunicorn, change the appropriate
# settings below, in order to provide the parameters that
# would normally be passed in the command-line,
# (at least `bind` and `conf['addons_path']`), then execute:
# $ gunicorn openerp:wsgi.core.application -c gunicorn.conf.py
# or if you want to run it behind a reverse proxy, add the line
import openerp.wsgi.proxied
# in this file and execute:
# $ gunicorn openerp:wsgi.proxied.application -c gunicorn.conf.py

import openerp

# Standard OpenERP XML-RPC port is 8069
bind = '192.168.71.133:8069'

pidfile = '.gunicorn.pid'

# Gunicorn recommends 2-4 x number_of_cpu_cores, but
# you'll want to vary this a bit to find the best for your
# particular work load.
workers = 2

# Some application-wide initialization is needed.
on_starting = openerp.wsgi.core.on_starting
when_ready = openerp.wsgi.core.when_ready
pre_request = openerp.wsgi.core.pre_request
post_request = openerp.wsgi.core.post_request

# openerp request-response cycle can be quite long for
# big reports for example
timeout = 240

max_requests = 2000

# Equivalent of --load command-line option
openerp.conf.server_wide_modules = ['web']

# internal TODO: use openerp.conf.xxx when available

# internal TODO: use openerp.conf.xxx when available
conf = openerp.tools.config

# Path to the OpenERP Addons repository (comma-separated for
# multiple locations)
conf['addons_path'] = '/usr/lib/pymodules/python2.6/openerp/addons/web/,/usr/local/lib/python2.6/dist-packages/openerp-server/addons,/usr/local/lib/python2.6/dist-packages/openerp-6.1_1-py2.6.egg/openerp/addons'

# Optional database config if not using local socket
conf['db_name'] = 'test'
conf['db_host'] = '192.168.71.136'
conf['db_port'] = '5432'
conf['db_user'] = 'XXXXXXXX'
conf['db_password'] = 'XXXXXXXX'

conf['port'] = 8069
conf['xmlrpc'] = True

# OpenERP Log Level
# DEBUG=10, DEBUG_RPC=8, DEBUG_RPC_ANSWER=6, DEBUG_SQL=5, INFO=20,
# WARNING=30, ERROR=40, CRITICAL=50
conf['log_level'] = 20
conf['logfile']='/var/log/openerp-server.log'

# If --static-http-enable is used, path for the static web directory
#conf['static_http_document_root'] = '/var/www'

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

Any help will be much appreciated.

E

Question information

Language:
English Edit question
Status:
Answered
For:
Odoo Server (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Vo Minh Thu (thu) said :
#1

Can you please provide some more information:
- OS
- The result of 'ls /usr/lib/pymodules/python2.6/openerp/addons/web/'

If the latter incldues an 'addons' directory, replace it with '/usr/lib/pymodules/python2.6/openerp/addons/web/addons'

Revision history for this message
Esteban Díaz Asúa (b-esteban-diaz) said :
#2

I adde web out of desperation... I think the addons are just in /usr/lib/pymodules/python2.6/openerp/addons

 in any case:

 root@openerp61Pro1:/proc# cat /proc/version
Linux version 2.6.32-5-amd64 (Debian 2.6.32-41squeeze2) (<email address hidden>) (gcc version 4.3.5 (Debian 4.3.5-4) ) #1 SMP Thu Mar 22 17:26:33 UTC 2012

root@openerp61Pro1:/proc# ls /usr/lib/pymodules/python2.6/openerp/addons/web/
common controllers i18n __init__.py __init__.pyc __openerp__.py __openerp__.pyc static test

root@openerp61Pro1:/proc# ls /usr/lib/pymodules/python2.6/openerp/addons
account hr plugin_outlook
account_accountant hr_attendance plugin_thunderbird
account_analytic_analysis hr_contract point_of_sale
account_analytic_default hr_evaluation portal
account_analytic_plans hr_expense process
account_anglo_saxon hr_holidays procurement
account_asset hr_payroll product
account_bank_statement_extensions hr_payroll_account product_expiry
account_budget hr_recruitment product_manufacturer
account_cancel hr_timesheet product_margin
account_chart hr_timesheet_invoice product_visible_discount
account_check_writing hr_timesheet_sheet profile_tools
account_coda html_view project
account_followup idea project_gtd
account_invoice_layout import_base project_issue
account_payment import_google project_issue_sheet
account_sequence import_sugarcrm project_long_term
account_voucher __init__.py project_mailgate
analytic __init__.pyc project_messages
analytic_journal_billing_rate knowledge project_mrp
analytic_user_function l10n_at project_planning
anonymization l10n_be project_retro_planning
association l10n_be_hr_payroll project_scrum
auction l10n_be_invoice_bba project_timesheet
audittrail l10n_br purchase
auth_openid l10n_ca purchase_analytic_plans
base l10n_ch purchase_double_validation
base_action_rule l10n_cn purchase_requisition
base_calendar l10n_cr report_designer
base_contact l10n_de report_intrastat
base_crypt l10n_ec report_webkit
base_iban l10n_es report_webkit_sample
base_module_doc_rst l10n_fr resource
base_module_quality l10n_fr_rib sale
base_module_record l10n_gr sale_analytic_plans
base_quality_interrogation.py l10n_gt sale_crm
base_quality_interrogation.pyc l10n_hn sale_journal
base_report_designer l10n_in sale_layout
base_setup l10n_it sale_margin
base_synchro l10n_lu sale_mrp
base_tools l10n_ma sale_order_dates
base_vat l10n_multilang share
board l10n_mx stock
caldav l10n_nl stock_invoice_directly
claim_from_delivery l10n_pe stock_location
crm l10n_pl stock_no_autopicking
crm_caldav l10n_ro stock_planning
crm_claim l10n_syscohada subscription
crm_fundraising l10n_th survey
crm_helpdesk l10n_tr users_ldap
crm_partner_assign l10n_uk warning
crm_profiling l10n_us web
crm_todo l10n_uy web_calendar
decimal_precision l10n_ve web_dashboard
delivery lunch web_diagram
document mail web_gantt
document_ftp marketing web_graph
document_webdav marketing_campaign web_hello
edi marketing_campaign_crm_demo web_kanban
email_template membership web_livechat
event mrp web_mobile
event_project mrp_jit web_process
fetchmail mrp_operations web_rpc
fetchmail_crm mrp_repair web_tests
fetchmail_crm_claim mrp_subproduct web_uservoice
fetchmail_hr_recruitment multi_company wiki
fetchmail_project_issue pad wiki_faq
google_base_account pad_project wiki_quality_manual
google_map plugin wiki_sale_faq

E

Revision history for this message
Esteban Díaz Asúa (b-esteban-diaz) said :
#3

but entering only /usr/lib/pymodules/python2.6/openerp/addons does not seem to cut it... the install is the standard one I did with python setup.py install

Funny thing is that starting things with service openerp start works perfectly...

E

Revision history for this message
Vo Minh Thu (thu) said :
#4

Just give /usr/lib/pymodules/python2.6/openerp/addons.

From your 'ls', everything is there, including the web addons. No need for the '/web suffix'.

(The path ending with '/addons' in your config is *not* the one you made 'ls' with.)

Revision history for this message
Esteban Díaz Asúa (b-esteban-diaz) said :
#5

Ok, dit it... it still does not load...

Is there any logging I can look at... problem is that the openerp log does not event start...

Attached the snippet, that I changed.

# Equivalent of --load command-line option
openerp.conf.server_wide_modules = ['web']

# internal TODO: use openerp.conf.xxx when available
conf = openerp.tools.config

# Path to the OpenERP Addons repository (comma-separated for
# multiple locations)
conf['addons_path'] = '/usr/lib/pymodules/python2.6/openerp/addons'

# Optional database config if not using local socket
conf['db_name'] = 'test'
conf['db_host'] = '192.168.71.136'

Revision history for this message
Vo Minh Thu (thu) said :
#6

Weird.

So you say you run the command

  gunicorn openerp:wsgi.core.application -c gunicorn.conf.py

Do you run it from a directory actually containing the gunicorn.conf.py ?

Revision history for this message
Esteban Díaz Asúa (b-esteban-diaz) said :
#7

Correct, I attach details:

Estebans-Mac:~ esteban$ ssh root@192.168.71.133
root@192.168.71.133's password:
Linux openerp61Pro1 2.6.32-5-amd64 #1 SMP Thu Mar 22 17:26:33 UTC 2012 x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Wed Apr 25 11:33:00 2012 from 192.168.71.190
root@openerp61Pro1:~# cd /etc/openerp
root@openerp61Pro1:/etc/openerp# ls
gunicorn-2.conf.py gunicorn.conf.py openerp-server.conf
gunicorn-3.conf.py myapp openerp-server.conf.dpkg-old
root@openerp61Pro1:/etc/openerp# gunicorn openerp:wsgi.core.application -c gunicorn.conf.py &
[1] 31755
root@openerp61Pro1:/etc/openerp# 2012-04-25 13:14:50 [31755] [INFO] Arbiter booted
2012-04-25 13:14:50,347 INFO Arbiter booted
2012-04-25 13:14:50 [31755] [INFO] Listening at: http://192.168.71.133:8069
2012-04-25 13:14:50,348 INFO Listening at: http://192.168.71.133:8069
2012-04-25 13:14:50 [31756] [INFO] Worker spawned (pid: 31756)
2012-04-25 13:14:50,349 INFO Worker spawned (pid: 31756)
2012-04-25 13:14:50 [31757] [INFO] Worker spawned (pid: 31757)
2012-04-25 13:14:50,351 INFO Worker spawned (pid: 31757)

And then we get the no handler thing...

Revision history for this message
Vo Minh Thu (thu) said :
#8

Can you also please add the lines appearingin the console when you access the server and the no handler message is triggered. I would like to see what addons paths are loaded.

Revision history for this message
Esteban Díaz Asúa (b-esteban-diaz) said :
#9

ermmmm, don't seem to get any messages, I have tried with

# OpenERP Log Level
# DEBUG=10, DEBUG_RPC=8, DEBUG_RPC_ANSWER=6, DEBUG_SQL=5, INFO=20,
# WARNING=30, ERROR=40, CRITICAL=50
conf['log_level'] = 10
#conf['logfile']='/var/log/openerp-server.log'

And then with

# OpenERP Log Level
# DEBUG=10, DEBUG_RPC=8, DEBUG_RPC_ANSWER=6, DEBUG_SQL=5, INFO=20,
# WARNING=30, ERROR=40, CRITICAL=50
conf['log_level'] = 10
conf['logfile']='/var/log/openerp-server.log'

But nothing writes to the log...

The ps tells me...

root@openerp61Pro1:/etc/openerp# gunicorn openerp:wsgi.core.application -c gunicorn.conf.py &
[1] 31868
root@openerp61Pro1:/etc/openerp# 2012-04-25 13:49:18 [31868] [INFO] Arbiter booted
2012-04-25 13:49:18,471 INFO Arbiter booted
2012-04-25 13:49:18 [31868] [INFO] Listening at: http://192.168.71.133:8069
2012-04-25 13:49:18,471 INFO Listening at: http://192.168.71.133:8069
2012-04-25 13:49:18 [31869] [INFO] Worker spawned (pid: 31869)
2012-04-25 13:49:18,473 INFO Worker spawned (pid: 31869)
2012-04-25 13:49:18 [31870] [INFO] Worker spawned (pid: 31870)
2012-04-25 13:49:18,475 INFO Worker spawned (pid: 31870)

root@openerp61Pro1:/etc/openerp#
root@openerp61Pro1:/etc/openerp# ps -ef |grep gunicorn
root 31868 31740 3 13:49 pts/0 00:00:00 /usr/bin/python /usr/bin/gunicorn openerp:wsgi.core.application -c gunicorn.conf.py
root 31869 31868 0 13:49 pts/0 00:00:00 /usr/bin/python /usr/bin/gunicorn openerp:wsgi.core.application -c gunicorn.conf.py
root 31870 31868 0 13:49 pts/0 00:00:00 /usr/bin/python /usr/bin/gunicorn openerp:wsgi.core.application -c gunicorn.conf.py
root 31874 31740 0 13:49 pts/0 00:00:00 grep gunicorn

:-(

Revision history for this message
James Jesudason (jamesj) said :
#10

We set up all the config a config file and then use that in our
gunicorn file (instead of hard-coding everything in the script). As
long as the config file is set up correctly, this works for us:

config_file = "/path/to/openerp.conf"
if not os.path.exists(config_file):
    print "Config file '%s' not found " % (config_file)
    sys.exit()
else:
    # read from config file
    openerp.tools.config.parse_config(['-c', config_file])

# Equivalent of --load command-line option
openerp.conf.server_wide_modules =
openerp.tools.config['server_wide_modules'].split(',')

(At some stage the last line won't be needed).

Revision history for this message
Juan Ignacio Ubeda Goenaga (euskskl) said :
#11

Hello James,

Can you help me ?

 if not os.path.exists(config_file):
NameError: name 'os' is not defined

Thanks ;)

Revision history for this message
Juan Ignacio Ubeda Goenaga (euskskl) said :
#12

I solved my problem but I still can not boot properly gunicorn

Revision history for this message
Cristian Salamea (ovnicraft) said :
#13

Do you try this :

gunicorn openerp:wsgi.core.application -c gunicorn.conf.py

or what means " I still can not boot properly gunicorn"

Regards,

Revision history for this message
DaleEMoore (daleemoore) said :
#14

I encountered the dreaded OpenERP "no handler found" error when learning to download source and program OpenERP. Even going back to the standard release "wget http://nightly.openerp.com/6.1/releases/openerp_6.1-latest-1_all.deb" didn't help. This resolved the issue for me.

root@QnD:/usr/local/lib/python2.7/dist-packages# rm -rf openerp-7.0alpha-py2.7.egg/

FYI,
<email address hidden>

Revision history for this message
João Pedro Afonso Oliveira de Almeida (jpoa) said :
#15

Greetings!

I'm experiencing the same issue.

Debian 6.0 here, tried both with manual install and deb.

The regular instance of OpenERP works, but with gunicorn its a no go, I always get the No handler error.

I also dont get any log at all.

Any hints?

Revision history for this message
João Pedro Afonso Oliveira de Almeida (jpoa) said :
#16

Greetings!

Any updates for this? Next step would be to try it with Ubuntu and see if it is some weird conf of python/system libs.

This is on Debian 6.0 stable.

Best regards.

Can you help with this problem?

Provide an answer of your own, or ask Esteban Díaz Asúa for more information if necessary.

To post a message you must log in.