-1
我有以下脚本:无法在瓶子应用程序中创建sqlite3数据库?
#!flask/bin/python
import os
from flask import Flask, render_template, request, url_for
from flask.ext.sqlalchemy import SQLAlchemy
app = Flask("hello")
basedir = os.path.abspath(os.path.dirname(__file__))
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'app.sqlite3')
print SQLALCHEMY_DATABASE_URI
db = SQLAlchemy(app)
db.create_all()
print db
但是当我实际运行该脚本,我没有看到任何东西:
$ python db_create.py
sqlite:////home/ubuntu/Paw/paw/app.sqlite3
/home/ubuntu/.virtualenvs/paw-py/local/lib/python2.7/site-packages/flask_sqlalchemy/__init__.py:800: UserWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future. Set it to True to suppress this warning.
warnings.warn('SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future. Set it to True to suppress this warning.')
<SQLAlchemy engine='sqlite://'>
那么,为什么我看到被放置在内存中的SQLAlchemy的发动机?
我的权限似乎也不错。