使用mod_wsgi部署我的烧瓶应用程序时出错。这是错误日志:
df <- gather(df2, key = "key", value = "value", A, B, C)
df <- unite(df, "key", key, kind, type, sep = "")
df <- spread(df, key, value)
df
## id A1U_sweet A2F_dip A3U_bbq B1U_sweet B2F_dip B3U_bbq C1U_sweet C2F_dip
## 1 1 1 2 1 1 2 1 NA NA
## 2 2 NA NA NA 4 1 2 4 1
## 3 3 2 4 7 2 4 7 NA NA
## C3U_bbq
## 1 NA
## 2 2
## 3 NA
我在itemcatalog目录中有一个 init .py文件,我做了一些搜索,发现也许python没有将我的itemcatalog识别为包,这是什么原因?
Python全局安装但后来我也尝试在虚拟环境中安装它。
这是虚拟主机的代码:
[Sat Feb 10 01:58:24.785611 2018] [wsgi:error] [pid 17184:tid 140591748056832] [remote 41.36.31.164:45065] mod_wsgi (pid=17184): Target WSGI script '/var/www/itemcatalog/itemcatalog.wsgi' cannot be loaded as Python module.
[Sat Feb 10 01:58:24.785635 2018] [wsgi:error] [pid 17184:tid 140591748056832] [remote 41.36.31.164:45065] mod_wsgi (pid=17184): Exception occurred processing WSGI script '/var/www/itemcatalog/itemcatalog.wsgi'.
[Sat Feb 10 01:58:24.785649 2018] [wsgi:error] [pid 17184:tid 140591748056832] [remote 41.36.31.164:45065] Traceback (most recent call last):
[Sat Feb 10 01:58:24.785664 2018] [wsgi:error] [pid 17184:tid 140591748056832] [remote 41.36.31.164:45065] File "/var/www/itemcatalog/itemcatalog.wsgi", line 6, in <module>
[Sat Feb 10 01:58:24.785710 2018] [wsgi:error] [pid 17184:tid 140591748056832] [remote 41.36.31.164:45065] from itemcatalog import app as application
[Sat Feb 10 01:58:24.785729 2018] [wsgi:error] [pid 17184:tid 140591748056832] [remote 41.36.31.164:45065] ImportError: No module named itemcatalog
这是<VirtualHost *:80>
ServerName 18.194.244.229
ServerAdmin admin@18.194.244.229
WSGIDaemonProcess itemcatalog python-path=/var/www/itemcatalog:/var/www/itemcatalog/venv/lib/python2.7/site-packages
WSGIProcessGroup itemcatalog
WSGIScriptAlias / /var/www/itemcatalog/itemcatalog.wsgi
<Directory /var/www/itemcatalog/>
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
答案 0 :(得分:1)
而不是:
WSGIDaemonProcess itemcatalog python-path=/var/www/itemcatalog:/var/www/itemcatalog/venv/lib/python2.7/site-packages
使用:
WSGIDaemonProcess itemcatalog python-path=/var/www \
python-home=/var/www/itemcatalog/venv
Python路径必须是包的父目录,而不是包目录本身。
不使用python-path
设置虚拟环境,而是使用官方文档中所述的python-home
: