我正在尝试在一个linode服务器上部署一个Django项目,该服务器上有apache,一些其他django项目和一个php项目。我的项目也是在virualenv,而其他django项目则不是。
我的Django项目apache文件是
WSGIPythonPath /home/nccylli/www/ylli_transactions:/root/Envs/ylli-transactions/lib/python2.6/site-packages
WSGISocketPrefix /var/run/apache2/wsgi
WSGIScriptAlias / /home/nccylli/www/ylli_transactions/ylli_transactions/wsgi.py
DocumentRoot /home/nccylli/www/ylli_transactions/static
<Directory /home/nccylli/www/ylli_transactions>
<Files wsgi.py>
Order allow,deny
Allow from all
</Files>
</Directory>
Alias /static /home/nccylli/www/ylli_transactions/static
Alias /media /home/nccylli/www/ylli_transactions/media
ErrorLog /home/nccylli/www/ylli_transactions/logs/error.log
CustomLog /home/nccylli/www/ylli_transactions/logs/access.log combined
<VirtualHost *:80>
ServerName my-domain.com
ServerAlias www.my-domain.com
ServerAdmin my-email
</VirtualHost>
PHP项目apache文件
<VirtualHost *:80>
ServerName php-prject-domain
ServerAlias www.php-prject-domain
DocumentRoot /home/nccylli/www/php-prject/
CustomLog /var/log/apache2/php-prject-access.log combined
ErrorLog /var/log/apache2/php-prject-error.log
<IfModule mpm_itk_module>
AssignUserId nccylli nccylli
</IfModule>
</VirtualHost>
现在我遇到了两个错误 在django项目错误日志中
(13)Permission denied: access to / denied
(13)Permission denied: mod_wsgi (pid=9780, process='', application='my-domain.com|'): Call to fopen() failed for '/home/nccylli/www/ylli_transactions/ylli_transactions/wsgi.py'.
并在php项目错误日志中
mod_wsgi (pid=26782): Target WSGI script '/home/nccylli/www/ylli_transactions/ylli_transactions/wsgi.py' cannot be loaded as Python module.
mod_wsgi (pid=26782): Exception occurred processing WSGI script '/home/nccylli/www/ylli_transactions/ylli_transactions/wsgi.py'.
Traceback (most recent call last):
File "/home/nccylli/www/ylli_transactions/ylli_transactions/wsgi.py", line 13, in <module>
from django.core.wsgi import get_wsgi_application
ImportError: No module named wsgi
有什么想法吗?
答案 0 :(得分:1)
尝试使用以下代码:
<Directory /home/nccylli/www/ylli_transactions/ylli_transactions>
<Files wsgi.py>
Order allow,deny
Allow from all
</Files>
</Directory>