I am banging my head over this one. I have successfully completed the SQLAlcemy + URL Dispatch tutorial in the past. Now whatever I do, the attempts to write to the sqlite db file all fail, throwing:
OperationalError: (OperationalError) attempt to write a readonly database u'INSERT INTO pages (name, data) VALUES (?, ?)' (u'NewPage', u'A new page is dawning.')
The variations in my current configuration are:
- I am running through the tutorial under mod_wsgi, not the pserve.
- result is the same running under pserve
- this system is running python 2.6.5 vs 2.7.5
The datafile initializes fine. The ownership is the same as the wsgi process owner. I'm baffled.
Here's the models.py:
from sqlalchemy import (
Column,
Index,
Integer,
Text,
)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import (
scoped_session,
sessionmaker,
)
from zope.sqlalchemy import ZopeTransactionExtension
DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension()))
Base = declarative_base()
class Page(Base):
__tablename__ = 'pages'
id = Column(Integer, primary_key=True)
name = Column(Text, unique=True)
data = Column(Text)
def __init__(self, name, data):
self.name = name
self.data = data
Index('page_index', Page.name, unique=True, mysql_length=255)
Pretty straightforward out of the tutorial.
Any thoughts greatly appreciated.