mercredi 20 mai 2015

SQLite3 Error in Pyhton after run on LOCALHOST; works in CONSOLE

I have created and populated a sqllite database in a Python + Flask + SQLAlchemy app.

When I run the DBHandl.getData() in my console, I get the data. There is Connection and I can both read and write.

But when I use Pycharm to run the app at localhost:5000 I can not connect and get this error:

OperationalError: (sqlite3.OperationalError) unable to open database file

None of the usual errors aply. No funny charakters, no access-restrictions, no typos. I created the /temp/ folder and checked if it is write-protected.I run pycharm as an admin on win8.

As I said, data-access (read and write) WORKS in my console.

**Imports, DB-Setup & Classes**

class DBHandl():
    @classmethod
    def getData(self):  # Return Personen + Adressen
        q = session.query(Person, Address).filter(Person.id == Address.person_id).all()
        return q

@app.route('/')
def hello_world():
    q = DBHandl.getData()
    return render_template("home.html", list=q)

Is the problem that sqlite can not be run on localhost? or do i have to setup the db again?

Aucun commentaire:

Enregistrer un commentaire