每当我运行命令以将 Virtualbox 驱动程序启动 Minishift 到操作系统主机时,它都需要一段疯狂的时间,而且它永远不会结束。有时我什至收到有关达到存储限制的错误消息。
我想知道是否是这里描述的 Persistent storage volume configuration and usage 的错误
mike@mike-thinks:~$ minishift start --vm-driver=virtualbox
-- Starting profile 'minishift'
-- Check if depereccated options are used ... OK
-- Checking if https://github.com is reachable ... OK
-- Checking if requested OpenShift version 'v3.9.0' is valid ... OK
-- Checking if requested OpenShift version 'v3.9.0' is supported ... OK
-- Checking if requested hypervisor 'virtualbox' is supported on this platform ... OK
-- Checking if VirtualBox is …Run Code Online (Sandbox Code Playgroud) 我在microblog.py文件~/Programing/Rasa/myflaskapp/app夹中的文件中创建了以下函数。它创建一个 shell 上下文,将数据库实例和模型添加到 shell 会话:
from app import app, db
from app.models import User, Post
@app.shell_context_processor
def make_shell_context():
return {'db': db, 'User': User, 'Post': Post}
Run Code Online (Sandbox Code Playgroud)
该app.shell_context_processor解码器寄存器的功能作为壳上下文功能。但是当执行flask shell命令时,in~/Programing/Rasa/myflaskapp/它并没有调用这个函数,而是按预期在shell会话中记录它返回的元素。
所以我明白了:
(MyFlaskAppEnv) mike@mike-thinks:~/Programing/Rasa/myflaskapp$ flask shell
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
App: app [production]
Instance: /home/mike/Programing/Rasa/myflaskapp/instance
>>> db
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'db' is not defined
Run Code Online (Sandbox Code Playgroud)
而不是 :
(venv) $ …Run Code Online (Sandbox Code Playgroud) 我有一个关于 Heroku 的数据库。字段会自动填充日期。我尝试使用current_timestamp,但似乎不起作用。
这是数据库的架构。
drop table if exists users;
create table users (
id int GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
name varchar,
email varchar,
username varchar,
password varchar,
register_date CURRENT_TIMESTAMP() not null
);
Run Code Online (Sandbox Code Playgroud)
这是查询:
cur.execute("INSERT INTO users(name, email, username, password) VALUES(%s, %s, %s, %s)", (name, email, username, password))
Run Code Online (Sandbox Code Playgroud)
这是错误:
ERROR: syntax error at or near "CURRENT_TIMESTAMP"
LINE 7: register_date CURRENT_TIMESTAMP() not null
Run Code Online (Sandbox Code Playgroud)