我是部署新手,我一直在尝试部署我的 django 应用程序,但我似乎只能获得默认的 :"it works"
页面才能工作。我遵循了一些教程,但没有运气。我的'/etc/apache2/sites-available/37.***.22.**'
虚拟主机:
`<VirtualHost *:80>
ServerAdmin webmaster@37.***.22.**
ServerName 37.***.22.**
DocumentRoot /var/www/37.***.22.**/public_html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/37.***.22.**/public_html>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
WSGI 文件:
import os
import sys
import site
# Add the site-packages of the chosen virtualenv to work with
site.addsitedir('~/.virtualenvs/myprojectenv/local/lib/python2.7/site-packages')
# Add the app's directory to the PYTHONPATH
sys.path.append('~/MyProject/django-bookmarks')
sys.path.append('~/MyProject/django-bookmarks/django_bookmarks')
os.environ['DJANGO_SETTINGS_MODULE'] = 'django_bookmarks.settings'
# Activate your virtual env
activate_env=os.path.expanduser("~/.virtualenvs/myprojectenv/bin/activate_this.$
execfile(activate_env, dict(__file__=activate_env))
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
我已经将我的 djagno 应用程序的文件 SCP'ed 到服务器上的 MyProject 目录中。我还运行a2ensite 37.***.22.25
并重新启动了 apache,但即便如此,我仍然会得到“它可以工作”的默认页面。我该如何解决这个问题?我还安装了 Postfgress。我真的很想尽快部署这个应用程序并且一直在苦苦挣扎,同时也学到了很多东西!任何建议将不胜感激。提前致谢。