Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/348.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在生产服务器上安装404_Python_Flask - Fatal编程技术网

Python 在生产服务器上安装404

Python 在生产服务器上安装404,python,flask,Python,Flask,在我的生产服务器上,当我试图访问www.example.com/admin时,我的flask应用程序抛出404。然而,如果我试图访问根内容,一切都正常。我将apache用于我的带有python 3.4的web服务器 @app.route('/') def index(): return render_template("search.html") . python functions in between . . . @app.route("/admin") def admin()

在我的生产服务器上,当我试图访问www.example.com/admin时,我的flask应用程序抛出404。然而,如果我试图访问根内容,一切都正常。我将apache用于我的带有python 3.4的web服务器

@app.route('/')
def index():
    return render_template("search.html")

. python functions in between
.
.
.


@app.route("/admin")
def admin():
    return render_template("adminAuth.html", error=False)

@app.route("/admin", methods=["POST"])
def adminAuth():
    # Intentionally return None
    return None
备注:在我的测试环境中,(PyCharm with Flask)一切正常,我可以访问/admin

这是我的WSGI配置文件

<VirtualHost *:80>
    ServerName NAME
    ServerAdmin admin@mywebsite.com
    WSGIScriptAlias / /path/to/app.wsgi
    <Directory /path/to/webapp/>
        Order allow,deny
        Allow from all
    </Directory>
    Alias /static /path/to/webapp/static
    <Directory /path/to/webapp/static/>
        Order allow,deny
        Allow from all
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/path/to/error.log
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/path/to/access.log combined
</VirtualHost>

服务器名
服务器管理员admin@mywebsite.com
WSGIScriptAlias//path/to/app.wsgi
命令允许,拒绝
通融
别名/static/path/to/webapp/static
命令允许,拒绝
通融
ErrorLog${APACHE_LOG_DIR}/path/to/error.LOG
日志级别警告
CustomLog${APACHE_LOG_DIR}/path/to/access.LOG组合

你能在生产中发布你的Apache配置吗?@mfitzp刚刚发布了上面的内容。你安装了mod_wsgi吗?