Skip to content

Instantly share code, notes, and snippets.

@danidee10
Created November 16, 2016 10:20
Show Gist options
  • Save danidee10/d051ae7927ce3b74d5731579828bf031 to your computer and use it in GitHub Desktop.
Save danidee10/d051ae7927ce3b74d5731579828bf031 to your computer and use it in GitHub Desktop.
Odoo wsgi file for running odoo10 as a wsgi application
# WSGI Handler sample configuration file.
#
# Change the appropriate settings below, in order to provide the parameters
# that would normally be passed in the command-line.
# (at least conf['addons_path'])
#
# For generic wsgi handlers a global application is defined.
# For uwsgi this should work:
# $ uwsgi_python --http :9090 --pythonpath . --wsgi-file openerp-wsgi.py
#
# For gunicorn additional globals need to be defined in the Gunicorn section.
# Then the following command should run:
# $ gunicorn openerp:service.wsgi_server.application -c openerp-wsgi.py
import odoo
#----------------------------------------------------------
# Common
#----------------------------------------------------------
odoo.multi_process = True # Nah!
# Equivalent of --load command-line option
odoo.conf.server_wide_modules = ['web']
conf = odoo.tools.config
# Path to the OpenERP Addons repository (comma-separated for
# multiple locations)
conf['addons_path'] = 'addons'
# Optional database config if not using local socket
#conf['db_name'] = 'mycompany'
#conf['db_host'] = 'localhost'
#conf['db_user'] = 'foo'
#conf['db_port'] = 5432
#conf['db_password'] = 'secret'
#----------------------------------------------------------
# Generic WSGI handlers application
#----------------------------------------------------------
application = odoo.service.wsgi_server.application
odoo.service.server.load_server_wide_modules()
#----------------------------------------------------------
# Gunicorn
#----------------------------------------------------------
# Standard OpenERP XML-RPC port is 8069
bind = '127.0.0.1:8069'
pidfile = '.gunicorn.pid'
workers = 4
timeout = 240
max_requests = 2000
@VyBui
Copy link

VyBui commented Sep 19, 2017

hi @danidee10 I added this file to my odoo folder.

After I deployed it to an AWS elastic beanstalk it shows an error like this:
[Tue Sep 19 04:24:23.612228 2017] [:error] [pid 25851] [remote 127.0.0.1:33395] mod_wsgi (pid=25851): Target WSGI script '/opt/python/current/app/odoo-wsgi.py' cannot be loaded as Python module.
[Tue Sep 19 04:24:23.612253 2017] [:error] [pid 25851] [remote 127.0.0.1:33395] mod_wsgi (pid=25851): Exception occurred processing WSGI script '/opt/python/current/app/odoo-wsgi.py'.
[Tue Sep 19 04:24:23.612272 2017] [:error] [pid 25851] [remote 127.0.0.1:33395] Traceback (most recent call last):
[Tue Sep 19 04:24:23.612289 2017] [:error] [pid 25851] [remote 127.0.0.1:33395] File "/opt/python/current/app/odoo-wsgi.py", line 15, in
[Tue Sep 19 04:24:23.612342 2017] [:error] [pid 25851] [remote 127.0.0.1:33395] import odoo
[Tue Sep 19 04:24:23.612352 2017] [:error] [pid 25851] [remote 127.0.0.1:33395] File "/opt/python/current/app/odoo/init.py", line 60, in
[Tue Sep 19 04:24:23.612391 2017] [:error] [pid 25851] [remote 127.0.0.1:33395] import modules
[Tue Sep 19 04:24:23.612400 2017] [:error] [pid 25851] [remote 127.0.0.1:33395] File "/opt/python/current/app/odoo/modules/init.py", line 8, in
[Tue Sep 19 04:24:23.612428 2017] [:error] [pid 25851] [remote 127.0.0.1:33395] from . import db, graph, loading, migration, module, registry
[Tue Sep 19 04:24:23.612436 2017] [:error] [pid 25851] [remote 127.0.0.1:33395] File "/opt/python/current/app/odoo/modules/graph.py", line 13, in
[Tue Sep 19 04:24:23.612487 2017] [:error] [pid 25851] [remote 127.0.0.1:33395] import odoo.osv as osv
[Tue Sep 19 04:24:23.612495 2017] [:error] [pid 25851] [remote 127.0.0.1:33395] File "/opt/python/current/app/odoo/osv/init.py", line 4, in
[Tue Sep 19 04:24:23.612519 2017] [:error] [pid 25851] [remote 127.0.0.1:33395] import osv
[Tue Sep 19 04:24:23.612526 2017] [:error] [pid 25851] [remote 127.0.0.1:33395] File "/opt/python/current/app/odoo/osv/osv.py", line 4, in
[Tue Sep 19 04:24:23.612550 2017] [:error] [pid 25851] [remote 127.0.0.1:33395] from ..exceptions import except_orm
[Tue Sep 19 04:24:23.612558 2017] [:error] [pid 25851] [remote 127.0.0.1:33395] File "/opt/python/current/app/odoo/exceptions.py", line 15, in
[Tue Sep 19 04:24:23.612592 2017] [:error] [pid 25851] [remote 127.0.0.1:33395] from tools.func import frame_codeinfo
[Tue Sep 19 04:24:23.612600 2017] [:error] [pid 25851] [remote 127.0.0.1:33395] File "/opt/python/current/app/odoo/tools/init.py", line 8, in
[Tue Sep 19 04:24:23.612625 2017] [:error] [pid 25851] [remote 127.0.0.1:33395] from misc import *
[Tue Sep 19 04:24:23.612632 2017] [:error] [pid 25851] [remote 127.0.0.1:33395] File "/opt/python/current/app/odoo/tools/misc.py", line 16, in
[Tue Sep 19 04:24:23.612826 2017] [:error] [pid 25851] [remote 127.0.0.1:33395] import passlib.utils
[Tue Sep 19 04:24:23.612844 2017] [:error] [pid 25851] [remote 127.0.0.1:33395] ImportError: No module named passlib.utils

Could you tell me what I did wrong?
Thank you!

@tobsn
Copy link

tobsn commented Sep 30, 2019

@VyBui you ever solved that?

@danidee10
Copy link
Author

Hey guys. I'm not sure how I missed the initial comment from @VyBui two years ago 😬

running pip install passlib should get rid of the error

@VyBui
Copy link

VyBui commented Oct 1, 2019

LOL, I am pretty sure, I solved it by running pip install.

However, it was too long ago. I even changed my job =)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment