由于我机器上nginx占用了80端口,因此要先修改ports.conf修改端口: 在该文件 中添加下面两行: NameVirtualHost 127.0.0.0:8888 Listen 127.0.0.1 8888 然后在/etc/apache2/sites-available/default文件中加入以下内容: 1 <VirtualHost 127.0.0.1:8888> 2 ServerName 127.0.0.1 3 ServerAdmin test@test.com 4 DocumentRoot /home/tutu/dev/HouseRentPrj 5 ErrorLog /var/log/apache2/error.log 6 CustomLog /var/log/apache2/access.log combined 7 </VirtualHost> 8 9 <Directory /home/tutu/dev/HouseRentPrj> 10 SetHandler python-program 11 PythonPath "['/home/tutu/dev'] + sys.path" 12 PythonHandler django.core.handlers.modpython 13 SetEnv DJANGO_SETTINGS_MODULE HouseRentPrj.settings 14 PythonDebug On 15 </Directory>