0

我使用本教程让 Flask 在 IIS 服务器上运行,并且测试应用程序运行良好。

现在,我在 Visual Studios 2013 中开发了一个 Web 应用程序,它在 localhost 开发服务器上运行良好。

当我将文件传输到服务器时,除了 Flask 之外,每个包都出现以下错误,尽管我在服务器上安装了所有必需的包。请注意,我确实将init .py 更改为 app.py 以与教程一致.

Error occurred while reading WSGI handler:

Traceback (most recent call last):
  File "D:\...\wfastcgi.py", line 779, in main
    env, handler = read_wsgi_handler(response.physical_path)
  File "D:\...\wfastcgi.py", line 621, in read_wsgi_handler
    handler = get_wsgi_handler(os.getenv('WSGI_HANDLER'))
  File "D:\...\wfastcgi.py", line 605, in get_wsgi_handler
    raise ValueError('"%s" could not be imported%s' % (handler_name, last_tb))
ValueError: "app.app" could not be imported: Traceback (most recent call last):
  File "D:\...\wfastcgi.py", line 589, in get_wsgi_handler
    handler = __import__(module_name, fromlist=[name_list[0][0]])
  File ".\app.py", line 6, in <module>
    from flask_bootstrap import Bootstrap
ImportError: No module named 'flask_bootstrap'

StdOut: 

StdErr: 

所有导入(Flask 除外)都会出现此错误,包括 flask_sqlalchemy 等...

app.py(使用 Python 3.5)

from flask import Flask
from flask_bootstrap import Bootstrap
from flask_scss import Scss
from config import DevConfig, BaseConfig
from flask_admin import Admin
from flask_admin.contrib.sqla import ModelView
from flask_sqlalchemy import SQLAlchemy
from flask_mail import Mail

app = Flask(__name__)
app.config.from_object(BaseConfig)
db = SQLAlchemy(app)
mail = Mail(app)

Bootstrap(app)
admin = Admin(app, name='Admin', template_mode='bootstrap3')

import AppName.views

我的服务器文件夹是这样的:

/roothostingfolder
    app.py
    config.py
    models.py
    views.py
    wfastcgi.py
    web.config
    /static
        style.css
    /templates
        layout.html
        index.html
        login.html
        ...

你知道如何修复错误吗?

4

0 回答 0