【发布时间】:2014-11-24 11:35:46
【问题描述】:
我正在尝试使用 apache Web 服务器将我的 django 应用程序部署到 Digital Ocean。我正在关注this 和this 教程。但是,当我尝试远程访问我的网站时,我收到了错误:
Forbidden
You don't have permission to access / on this server.
我的网站虚拟主机文件,即 teenvestor,如下所示:
<VirtualHost *:80>
ServerName teenvestor.co.uk
ServerAlias www.teenvestor.co.uk
WSGIScriptAlias / /opt/teenvestor/teenvestor/apache/django.wsgi
Alias /static/ /opt/teenvestor/teenvestor/static/
<Location "/static/">
Options -Indexes
</Location >
</VirtualHost>
我已启用该网站。 我的 django.wsgi 文件如下所示:
import os
import sys
import site
# Add the site-packages of the chosen virtualenv to work with
site.addsitedir('/opt/teenvestor/lib/python2.7/site-packages')
# Add the app's directory to the PYTHONPATH
sys.path.append('/opt/teenvestor/teenvestor')
sys.path.append('/opt/teenvestor/teenvestor/teenvestor')
os.environ['DJANGO_SETTINGS_MODULE'] = 'teenvestor.settings'
# Activate your virtual env
activate_env=os.path.expanduser("~/opt/teenvestor/bin/activate_this.py")
execfile(activate_env, dict(__file__=activate_env))
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
PS:我正在使用 virtualenv。可能是什么问题?
【问题讨论】:
标签: python django apache linux-mint