Ich werde es als Memo hinterlassen, aber der Backlift-Service unter der folgenden URL ist möglicherweise leicht zu merken. Außerdem hat sich die Verzeichnisstruktur in der Django-Version geändert, sodass sie behoben werden muss.
http://jp.techcrunch.com/2013/04/11/20130410yc-backlift-launch/
Verzeichnisaufbau
sample
|-wsgi
|-dispatch.wsgi
|-src
|-sample
|-settings.py
|-・ ・ ・
dispatch.wsgi
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import site
import sys
sys.stdout = sys.stderr
PROJECT_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
# Add the virtual Python environment site-packages directory to the path
site.addsitedir(os.path.join(PROJECT_ROOT, 'python', 'lib', 'python2.7', 'site-packages'))
# Avoid ``[Errno 13] Permission denied: '/var/www/.python-eggs'`` messages
os.environ['PYTHON_EGG_CACHE'] = os.path.join(PROJECT_ROOT, 'wsgi', 'egg-cache')
#If your project is not on your PYTHONPATH by default you can add the following
sys.path.append(os.path.join(PROJECT_ROOT, 'src', 'sample'))
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
Platzieren Sie die folgenden Dateien in Sites-Available
sample
<VirtualHost *:80>
Servername Servername
# Log Files
ErrorLog /var/log/apache2/sample.error-lostquery.log
CustomLog /var/log/apache2/sample.access-lostquery.log combined
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule .*robots\.txt$ ~/sample/www/robots.txt [L]
Alias /www/ ~/sample/www/
<Directory ~/sample/www>
Order deny,allow
Allow from all
</Directory>
# Setup mod_wsgi
WSGIScriptAlias / ~/sample/wsgi/dispatch.wsgi
<Directory ~/sample/wsgi>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
Aktivieren Sie die Site in Apache und starten Sie sie neu
Recommended Posts