【发布时间】:2020-02-24 11:56:24
【问题描述】:
我的 apache 配置文件有:
<VirtualHost *:80>
ServerName localhost
WSGIDaemonProcess tasks4 python-path=/home/user1/Projects/tasks/tasks/tasks/wsgi.py:/home/user1/env_rt_dms:/home/user1/env_rt_dms/lib/python3.6/site-packages
WSGIScriptAlias / /home/user1/Projects/tasks/tasks/tasks/wsgi.py
WSGIPassAuthorization On
Alias /rt1 /home/user1/Projects/tasks/tasks/tasks/static/
<Directory /home/user1/Projects/tasks/tasks>
DirectoryIndex index.html
WSGIProcessGroup tasks4
WSGIApplicationGroup %{GLOBAL}
WSGIScriptReloading On
Require all granted
</Directory>
</VirtualHost>
wsgi 文件:
#! /home/user1/env_rt_dms/bin
import sys, os
activate_this = '/home/user1/env_rt_dms/bin/activate_this.py'
with open(activate_this) as file_:
exec(file_.read(), dict(__file__=activate_this))
os.environ['DB_URL']="postgresql://usernm:passwd1@localhost:5432/my_db"
from tasks import app as application
application.secret_key = '\x04\xf5\\VN:\xb7\xb9\xca\x95\xa3m!4@\x17\xfcg\xe5\xe2q\x05'
激活apache web服务器后的浏览器url:http://localhost/rt1给出404错误
apache 日志显示:mod_wsgi: Compiled for Python/3.4.2 作为警告。请让我知道我需要解决什么问题才能使此配置正常工作?
【问题讨论】:
-
“apache 日志显示:mod_wsgi: Compiled for Python/3.4.2 as warning”。你的python虚拟环境中安装了什么版本的python?为
WSGIDaemonProcess指令的python-path 选项配置的第一个目录是文件路径。您需要将其更正为包含应用程序的wsgi.py模块的文件夹。 -
@OluwafemiSule 1.将 WSGIDaemonProcess 更改为 tasks4 python-path=/home/user1/Projects/tasks/tasks/tasks/ 并尝试过。 2.也找不到用python/3.6编译的mod_wsgi。因此发布。此外,这只是一个警告,没有错误。您还能发现其他问题吗?
标签: python-3.x apache flask