![](/img/trans.png)
[英]Django on Apache with mod_wsgi: ImportError on settings
[英]Apache & mod_wsgi settings for Django Python Project
我正在嘗試在Google Compute Engine Debian8 VM上設置django-python項目。 我在/etc/apache2/sites-available/000-default.conf & /etc/apache2/sites-available/default-ssl.conf
文件中進行了一些配置更改,然后嘗試重新啟動服務器。 我得到了以下錯誤。 卸載和重新安裝apache2也不能解決此錯誤。 有解決此問題的建議嗎?
命令:
sudo service apache2 restart
錯誤:
Job for apache2.service failed. See 'systemctl status apache2.service' and 'journalctl -xn' for details.
命令:
sudo systemctl status apache2.service -l
錯誤:
apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2)
Active: active (exited) since Wed 2016-08-31 05:08:43 UTC; 3min 37s ago
Process: 3539 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
Process: 3521 ExecReload=/etc/init.d/apache2 reload (code=exited, status=1/FAILURE)
Process: 3546 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)
Unit apache2.service entered failed state.
Starting LSB: Apache2 web server...
Starting web server: apache2(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'start' failed.
The Apache error log may have more information.
.
Started LSB: Apache2 web server.
謝謝,
你讀錯了嗎? 明確說明了失敗的原因:
無法將/usr/lib/apache2/modules/mod_wsgi.so加載到服務器中:/usr/lib/apache2/modules/mod_wsgi.so:無法打開共享對象文件: 無此類文件或目錄
您是否安裝了libapache2-mod-wsgi
或libapache2-mod-wsgi-python3
? 如果您有權使用Shell,則可以使用
sudo apt-get install libapache2-mod-wsgi
# or for python 3
sudo apt-get install libapache2-mod-wsgi-python3
運行命令以查看端口80上運行的進程:
sudo netstat -ltnp | grep ':80'
輸出:
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 24482/nginx -g daem
tcp6 0 0 :::80 :::* LISTEN 24482/nginx -g daem
運行以下兩個命令,然后解決了該問題:
sudo kill -9 24482
sudo service apache2 restart
希望對您有所幫助。
謝謝,
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.