2018年6月22日 星期五

Ubuntu install postgresql & flask-sqlalchemy

# sudo apt install postgresql
# sudo systemctl enable postgresql
# sudo -i -u postgres
# createuser --interactive
jack
y
Note. already have a user named jack
# createdb jack
Note. create a database named jack.
logout from postgres
#logout

Edit the Flask app.py
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql:///jack'

You can save JSON type now
json = db.Column(db.JSON)

沒有留言:

張貼留言