-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的發動機?
我的權限似乎也不錯。