为了部署django项目,我下载了httpd和mod_wsgi。要配置此模块,我还下载了apxs和gcc,并且遵循了本教程: https://modwsgi.readthedocs.io/en/develop/user-guides/quick-configuration-guide.html 然后我在django文档中找到了: https://docs.djangoproject.com/fr/2.0/howto/deployment/wsgi/modwsgi/ 一种部署我的项目的方式。 所以我实际上有这个wigs.py:
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ProjetIML.settings")
application = get_wsgi_application()
还有这个httpd.conf:
WSGIScriptAlias / /home/ninon/ProjetIML/ProjetIML/wsgi.py
WSGIPythonPath /home/ninon/ProjetIML
<Directory /home/ninon/ProjetIML/ProjetIML>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
然后,我用“ apachectl restart”重新启动了apache服务器,当我尝试使用localhost:80访问我的站点时,没有任何追加。我错过了什么 ? 我看过很多文章,解释说他们已经编码了“ django.wsgi”之类的文件,但是我在django文档中没有找到任何有关它的内容。 我还尝试过添加如下虚拟主机:
<VirtualHost *:80>
WSGIScriptAlias / /home/ninon/ProjetIML/ProjetIML/wsgi.py
WSGIPythonPath /home/ninon/ProjetIML
<Directory /home/ninon/ProjetIML/ProjetIML>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
但是apache服务器不想重启。