我使用Postgresql连接到本地数据库时出错

时间:2020-06-07 11:00:03

标签: python postgresql flask-sqlalchemy

import json
import dateutil.parser
import babel
from flask import Flask, render_template, request, Response, flash, redirect, url_for, abort, jsonify
from flask_moment import Moment
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
import logging
from logging import Formatter, FileHandler
from flask_wtf import Form
from forms import *
from flask_migrate import Migrate
import sys
from datetime import datetime
#----------------------------------------------------------------------------#
# App Config.
#----------------------------------------------------------------------------#


app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://postgres:thiIsApassword@localhost:5432/mydatabase'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
moment = Moment(app)
db = SQLAlchemy(app)
app.config.from_object('config')
migrate = Migrate(app, db)

错误是::“ sqlalchemy.exc.ArgumentError: Could not parse rfc1738 URL from string '<Put your local database url>” 我不知道如何解决这个错误。我在互联网上浏览并使用postgresql连接到数据库,如下图image

所示

0 个答案:

没有答案