您如何将Web应用程序上载到生产服务器?

时间:2018-11-28 21:29:25

标签: python-3.x iis flask wsgi wfastcgi

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

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

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

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
        ...

您知道如何解决该错误吗?

0 个答案:

没有答案