我正在关注此处文档中的flask-cors教程:https ://pypi.python.org/pypi/Flask-Cors
但是当我将它安装在我的树莓派上并运行我的 python 应用程序时,我收到了这个错误
Traceback (most recent call last):
File "app.py", line 3, in <module>
from flask_cors import CORS, cross_origin
ImportError: No module named 'flask_cors'
这是我的python脚本:
from flask import Flask
from Main import main
from flask_cors import CORS, cross_origin
app = Flask(__name__)
CORS(app)
main = main()
@app.route('/turn' ,methods=['GET', 'OPTIONS'])
def index():
return main.turn()
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0')
Run Code Online (Sandbox Code Playgroud) 我正在处理一个项目,我试图在我的 SQL Server 数据库上设置一些带有架构的表,所以我手动将表名称更改为迁移文件上的 schema_name.table_name 并且它起作用了,所以这里是一个例子:
Schema::create('electoral.centro_votacions', function (Blueprint $table) {
$table->bigInteger('id_estado');
$table->bigInteger('id_municipio');
$table->bigInteger('id_parroquia');
$table->bigInteger('id');
$table->string('nombre');
$table->longText('direccion');
$table->foreign(['id_parroquia','id_municipio','id_estado'])->references(['id','id_municipio','id_estado'])->on('electoral.parroquias');
$table->primary('id');
});
Run Code Online (Sandbox Code Playgroud)
但是,当我试图对 php 进行雄辩的查询时,php artisan tinker它不起作用,我只是收到一条错误消息,例如进行查询App\CentroVotacion::all();:
Illuminate\Database\QueryException 带有消息“SQLSTATE[42S02]:[Microsoft][ODBC Driver 13 for SQL Server][SQL Server]无效的对象名称“centro_votacions”。(SQL: select * from [centro_votacions])'
当然我知道没有表“centro_votacions”有一个表叫“electoral.centro_votacions”,所以问题是我怎样才能让laravel改变查询,以便我可以找到“electoral.centro_votacions”表和其他我的 SQL Server DB 上的架构?。
database ×1
eloquent ×1
flask ×1
flask-cors ×1
laravel-5 ×1
python ×1
raspberry-pi ×1
sql-server ×1