import sqlite3 with Python2.7 on Heroku
Question: I'm trying Heroku with Python, I ran the ["hello word" example with
Flask](http://blog.heroku.com/archives/2011/9/28/python_and_django/)
successfully.

I now want to deploy a very basic application, using sqlite3 and Flask, and I
know the application was working. But I have trouble getting it to work, and I
suspect the problem is with sqlite.

When I started the Python shell that Heroku provides, here the import error
log:

    
    
    $ heroku run python     
    Running python attached to terminal... up, run.2
    Python 2.7.1 (r271:86832, Jun 26 2011, 01:08:11) 
    [GCC 4.4.3] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import sqlite3
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/local/lib/python2.7/sqlite3/__init__.py", line 24, in <module>
        from dbapi2 import *
      File "/usr/local/lib/python2.7/sqlite3/dbapi2.py", line 27, in <module>
        from _sqlite3 import *
    ImportError: No module named _sqlite3
    >>>
    

Do I need to add something to the `requirements.txt`, the file used for
dependencies? It only contains `Flask==0.8` so far. Import datetime in
examples works as expected. I looked with `heroku logs` and this message
appears as well, without any other important messages.

Do I have any way to use some sqlite3 on Heroku? Thanks for help.


Answer: This isn't possible on Heroku, as sqlite requires a permanent writable file
system. Since Heroku does not provide a permanent writable file system,
sqlite3 won't work.

Something to consider: Heroku is a distributed environment. This means an
application may run on many machines within many processes. In your case, this
would generate multiple sqlite3 instances (each running locally), were it
permitted.

Also, see: [Heroku Devcenter - Read-only
Filesystem](http://devcenter.heroku.com/articles/read-only-filesystem)

