我的 Python Flask/CGI 程序不断收到一个500 Internal Server Error
。
我在共享主机上运行它,所以我按照本教程进行操作: https ://medium.com/@dorukgezici/how-to-setup-python-flask-app-on-shared-hosting-without-root-access-e40f95ccc819
这是我的主要 python 脚本:(~/website/mainApp.py
)
from flask import Flask
app = Flask(__name__)
@app.route("/")
def home():
return "123 :)"
if __name__ == "__main__":
app.run()
这是我的 CGI 脚本 ( ~/website/main.cgi
)
#!/usr/bin/python
import sys
sys.path.insert(0, "~/.local/lib/python3.7/site-packages")
from wsgiref.handlers import CGIHandler
from mainApp import app
CGIHandler().run(app)
这是我的 .htaccess 文件(~/website/.htaccess
):
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /main.cgi/$1 [L]
这是我得到的错误:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
有谁看到错误可能在哪里?
谢谢!
编辑:它现在有一个奇怪的.pyc
文件。不过我没加。?