G
G
Gimir2018-03-30 00:35:20
Python
Gimir, 2018-03-30 00:35:20

How to connect my PostreSQL DB to Python on Ubuntu linux?

I shoveled everything I could but could not find anything that would explain how to do it.
How to connect the database that I created under my main account to python, that is, how to set the path to this database when I connect it? What needs to be changed here:

from flask import Flask, render_template
import postgresql

db = postgresql.open('postgresql://user:[email protected]/user') 
app = Flask(__name__)

@app.route('/')
def main():
    return 'Hello world'

if __name__ == '__main__':
  app.run(debug=True)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question