Хочу создать файл ".db", но выходит ошибка: Создавал я через консоль -
>>> from app import db
>>> db.create_all()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Никита\AppData\Local\Programs\Python\Python36\lib\site-packages
\flask_sqlalchemy\__init__.py", line 1033, in create_all
self._execute_for_all_tables(app, bind, 'create_all')
File "C:\Users\Никита\AppData\Local\Programs\Python\Python36\lib\site-packages
\flask_sqlalchemy\__init__.py", line 1025, in _execute_for_all_tables
op(bind=self.get_engine(app, bind), **extra)
File "C:\Users\Никита\AppData\Local\Programs\Python\Python36\lib\site-packages
\flask_sqlalchemy\__init__.py", line 956, in get_engine
return connector.get_engine()
File "C:\Users\Никита\AppData\Local\Programs\Python\Python36\lib\site-packages
\flask_sqlalchemy\__init__.py", line 559, in get_engine
sa_url = make_url(uri)
File "C:\Users\Никита\AppData\Local\Programs\Python\Python36\lib\site-packages
\sqlalchemy\engine\url.py", line 229, in make_url
return _parse_rfc1738_args(name_or_url)
File "C:\Users\Никита\AppData\Local\Programs\Python\Python36\lib\site-packages
\sqlalchemy\engine\url.py", line 291, in _parse_rfc1738_args
"Could not parse rfc1738 URL from string '%s'" % name
sqlalchemy.exc.ArgumentError: Could not parse rfc1738 URL from string 'ServerDat
a.db'
Вот сам скрипт:
from flask import Flask, render_template, url_for
from flask_sqlalchemy import SQLAlchemy
from datetime import datetime
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'ServerData.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
class Article(db.Model):
id = db.Column(db.Integer, primary_key=True)
titel = db.Column(db.String(100), nullable=False)
intro = db.Column(db.String(300), nullable=False)
text = db.Column(db.Text, nullable=False)
date = db.Column(db.DateTime, default=datetime.utcnow)
def __repr__(self):
return '<Article %r>' % self.id
@app.route('/')
def index():
return render_template("index.html")
@app.route('/admin/login/password')
@app.route('/admin')
def admin():
return render_template("admin.html")
#A8E7FF
#99E89C
#FFF4B5
if __name__ == "__main__":
app.run(debug=True)
Прошу помочь!