Problem deploying Kotti with uwsgi

52 views
Skip to first unread message

Neal Nelson

unread,
May 9, 2013, 12:07:47 PM5/9/13
to ko...@googlegroups.com
I'm trying out Kotti but I'm having major problems deploying it. I can install it fine and I can get it running fine with uwsgi as well when it does the http handling. The problem comes when I attach uwsgi to a web server. Initially things look OK until I try to log in, when I get the following error:

Traceback (most recent call last):
  File "/usr/local/www/kotti/lib/python2.7/site-packages/fanstatic/publisher.py", line 219, in __call__
    return self.app(environ, start_response)
  File "/usr/local/www/kotti/lib/python2.7/site-packages/fanstatic/injector.py", line 54, in __call__
    response = request.get_response(self.app)
  File "/usr/local/www/kotti/lib/python2.7/site-packages/webob/request.py", line 1296, in send
    application, catch_exc_info=False)
  File "/usr/local/www/kotti/lib/python2.7/site-packages/webob/request.py", line 1260, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/local/www/kotti/lib/python2.7/site-packages/pyramid/router.py", line 251, in __call__
    response = self.invoke_subrequest(request, use_tweens=True)
  File "/usr/local/www/kotti/lib/python2.7/site-packages/pyramid/router.py", line 227, in invoke_subrequest
    response = handle_request(request)
  File "/usr/local/www/kotti/lib/python2.7/site-packages/pyramid/tweens.py", line 21, in excview_tween
    response = handler(request)
  File "/usr/local/www/kotti/lib/python2.7/site-packages/pyramid_tm/__init__.py", line 82, in tm_tween
    reraise(*exc_info)
  File "/usr/local/www/kotti/lib/python2.7/site-packages/pyramid_tm/__init__.py", line 70, in tm_tween
    manager.commit()
  File "/usr/local/www/kotti/lib/python2.7/site-packages/transaction/_manager.py", line 111, in commit
    return self.get().commit()
  File "/usr/local/www/kotti/lib/python2.7/site-packages/transaction/_transaction.py", line 280, in commit
    reraise(t, v, tb)
  File "/usr/local/www/kotti/lib/python2.7/site-packages/transaction/_transaction.py", line 271, in commit
    self._commitResources()
  File "/usr/local/www/kotti/lib/python2.7/site-packages/transaction/_transaction.py", line 417, in _commitResources
    reraise(t, v, tb)
  File "/usr/local/www/kotti/lib/python2.7/site-packages/transaction/_transaction.py", line 389, in _commitResources
    rm.tpc_begin(self)
  File "/usr/local/www/kotti/lib/python2.7/site-packages/zope/sqlalchemy/datamanager.py", line 90, in tpc_begin
    self.session.flush()
  File "/usr/local/www/kotti/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 1817, in flush
    self._flush(objects)
  File "/usr/local/www/kotti/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 1935, in _flush
    transaction.rollback(_capture_exception=True)
  File "/usr/local/www/kotti/lib/python2.7/site-packages/sqlalchemy/util/langhelpers.py", line 58, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/usr/local/www/kotti/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 1899, in _flush
    flush_context.execute()
  File "/usr/local/www/kotti/lib/python2.7/site-packages/sqlalchemy/orm/unitofwork.py", line 372, in execute
    rec.execute(self)
  File "/usr/local/www/kotti/lib/python2.7/site-packages/sqlalchemy/orm/unitofwork.py", line 525, in execute
    uow
  File "/usr/local/www/kotti/lib/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 58, in save_obj
    mapper, table, update)
  File "/usr/local/www/kotti/lib/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 491, in _emit_update_statements
    execute(statement, params)
  File "/usr/local/www/kotti/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 662, in execute
    params)
  File "/usr/local/www/kotti/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 761, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/usr/local/www/kotti/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 874, in _execute_context
    context)
  File "/usr/local/www/kotti/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1024, in _handle_dbapi_exception
    exc_info
  File "/usr/local/www/kotti/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 163, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb)
  File "/usr/local/www/kotti/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 867, in _execute_context
    context)
  File "/usr/local/www/kotti/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 324, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (OperationalError) unable to open database file u'UPDATE principals SET last_login_date=? WHERE principals.id = ?' ('2013-05-09 17:46:29.996842', 1)

I have tried it both with the Cherokee and Mongrel2 web servers, both with the same results and I've also tried it both on MacOS X and FreeBSD, again with the same results.

Here's my uwsgi config file:

[uwsgi]
paste = config:/usr/local/www/kotti/app.ini
virtualenv = /usr/local/www/kotti
master = true

Which just loads the standard app.ini file.

If anyone has any ideas, I'd be very grateful.

Andreas Kaiser

unread,
May 10, 2013, 5:11:53 AM5/10/13
to ko...@googlegroups.com
Hi Neal,
from your description I'd guess that you are using SQLite and the user
running the web server doesn't have write permission on the database
file.

You can see a complete config for a Ubuntu, Nginx, uWSGI / uwsgi,
PostgreSQL stack (actually the one for http://kotti.pylonsproject.org/)
here: https://gist.github.com/disko/5553329


HTH,

Andreas

Neal Nelson

unread,
May 11, 2013, 5:19:44 AM5/11/13
to ko...@googlegroups.com


On Friday, 10 May 2013 11:11:53 UTC+2, Andreas Kaiser wrote:
Hi Neal,

from your description I'd guess that you are using SQLite and the user
running the web server doesn't have write permission on the database
file.

You can see a complete config for a Ubuntu, Nginx, uWSGI / uwsgi,
PostgreSQL stack (actually the one for http://kotti.pylonsproject.org/)
here: https://gist.github.com/disko/5553329


HTH,

Andreas

HI.

You were absolutely right. I was running it from the web server under the www user, but I tested it as root. Pretty silly really. I found the www user on my FreeBSD system is not configured for such things, so I created a special Kotti user,  reinstalled everything and it now just works as expected. I imagine this is a more normal way to run things than I was trying.

Ah well, in my defence I am trying out a new app written in a new framework using a new app server and a new web server. Now I understand better whats happening I'm sure I can get the other things I need going as well.

Thanks. 
Reply all
Reply to author
Forward
0 new messages