Ошибка сервера 500 при запуске приложения Flask со сценарием CGI ⇐ Python

Программы на Python
Anonymous
Ошибка сервера 500 при запуске приложения Flask со сценарием CGI

Сообщение Anonymous »

Я продолжаю получать ошибку 500 Internal Server Error при работе с моей программой Python Flask/CGI.
Я запускаю ее на общем хостинге, поэтому следовал этому руководству:
/>https://medium.com/@dorukgezici/how-to- ... 0f95ccc819
Это это мой основной скрипт 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. Я его не добавлял.?

Подробнее здесь: https://stackoverflow.com/questions/656 ... cgi-script

Вернуться в «Python»