[英]How to setup django on apache
I've been trying to run django on apache but I keep on getting 504 Gateway Timeout
. 我一直试图在apache上运行django,但是我一直在获取504 Gateway Timeout
。 Here is the site conf. 这是站点conf。 I've placed it in /etc/apache2/sites-available/ directory. 我将其放置在/ etc / apache2 / sites-available /目录中。
<VirtualHost *:80>
ServerName orounds.localhost
DocumentRoot /var/www/html/orounds_pro
WSGIScriptAlias / /var/www/html/orounds_pro/orounds_pro/wsgi.py
WSGIDaemonProcess orounds processes=2 threads=15 display-name=%{GROUP} python-home=/var/www/html/orounds_pro/venv/bin/python3
WSGIProcessGroup orounds
<directory /var/www/html/orounds_pro>
AllowOverride all
Require all granted
Options FollowSymlinks
</directory>
Alias /static/ /var/www/html/orounds_pro/static/
<Directory /var/www/html/orounds_pro/static>
Require all granted
</Directory>
</VirtualHost>
I'm using python3.6 and apache 2.4.29. 我正在使用python3.6和Apache 2.4.29。 I installed mod_wsgi
for apache with sudo apt-get install libapache2-mod-wsgi-py3
. 我使用sudo apt-get install libapache2-mod-wsgi-py3
为Apache安装了mod_wsgi
。 Is there anything I'm doing wrong or is there anything else I should do? 我有做错什么吗?还是应该做别的事情?
Regards. 问候。
<VirtualHost *:80>
. . .
Alias /static /home/user/myproject/static
<Directory /home/user/myproject/static>
Require all granted
</Directory>
<Directory /home/user/myproject/myproject>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIDaemonProcess myproject python-path=/home/user/myproject python-home=/home/user/myproject/myprojectenv
WSGIProcessGroup myproject
WSGIScriptAlias / /home/user/myproject/myproject/wsgi.py
Try above configuration also provide full permission to that same directory. 尝试上述配置还可以提供对该目录的完全许可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.