首页 > 解决方案 > 如何修复“警告:不要在生产环境中使用开发服务器。”

问题描述

当我尝试在 Spyder (python2.7) 中运行代码时,它立即告诉我:

runfile('hereisthefilepath',wdir='path') 
Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
Debug mode: off
Running on http://127.0.0.1:8050/ (Press CTRL+C to quit)

我将发布我的代码的开始,我认为问题是因为我连接到错误的环境,我应该在开发环境中。

我已经尝试过以下代码:

export FLASK_APP=yourapp
export FLASK_ENV=development
flash run

但是 Spyder (python2.7) 说“Flask_APP”和“ENV”有语法错误

这是我的代码:

import pandas as pd
import numpy as np
import pyodbc
import dash_html_components as html
import dash_core_components as dcc
from dash.dependencies import Input, Output, State
import dash


currconn = pyodbc.connect('Driver={SQL Server};Server=xxxx-dbs-xx.xx.xxxx.ca;Database=Anexample;UID=xx_xxxx;PWD=xxxxxxxxxxx')

currquery = "SELECT DISTINCT country FROM dbo.vw_regions"
currcursor = currconn.cursor()
currcursor.execute(currquery)

任何人都可以帮助我吗?出现此错误,我无法运行任何东西。

标签: pythonsql-serverpython-2.7

解决方案


推荐阅读