Flask Documentation (1.1.x)like this: /home/user/Projects/flask-tutorial ├── flaskr/ │ ├── __init__.py │ ├── db.py │ ├── schema.sql │ ├── auth.py │ ├── blog.py │ ├── templates/ │ │ ├── base.html │ │ ├── auth/ │ posts in the post table. Create a file with the SQL commands needed to create empty tables: flaskr/schema.sql DROP TABLE IF EXISTS user; DROP TABLE IF EXISTS post; CREATE TABLE user ( id INTEGER PRIMARY the db.py file: flaskr/db.py def init_db(): db = get_db() with current_app.open_resource('schema.sql') as f: db.executescript(f.read().decode('utf8')) @click.command('init-db') @with_appcontext0 码力 | 428 页 | 895.98 KB | 1 年前3
Flask Documentation (1.1.x)project layout will look like this: /home/user/Projects/flask-tutorial flaskr/ __init__.py db.py schema.sql auth.py blog.py templates/ base.html auth/ login.html register.html blog/ create.html index post table. Create a file with the SQL commands needed to create empty tables: Listing 5: flaskr/schema.sql DROP TABLE IF EXISTS user; DROP TABLE IF EXISTS post; (continues on next page) 26 Chapter py file: Listing 6: flaskr/db.py def init_db(): db = get_db() with current_app.open_resource('schema.sql') as f: db.executescript(f.read().decode('utf8')) @click.command('init-db') @with_appcontext0 码力 | 291 页 | 1.25 MB | 1 年前3
共 2 条
- 1
相关搜索词













