I\'d like to create a file with the name passenger_wsgi.py on a remote host. I\'d like to use the following string to create the file\'s content:
\'\'\'
import s
StringIO with put works with a little bit of editing. Try this:
put(StringIO.StringIO(
'''
import sys, os
sys.path.insert(0, "/ruby/%s/www/%s/django-projects")
sys.path.insert(0, "/ruby/%s/www/%s/django-projects/project")
import django.core.handlers.wsgi
os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings'
application = django.core.handlers.wsgi.WSGIHandler()
''' % (user,host,user,host)), "remote-path")
if you have an issue with permissions, try this:
put(StringIO.StringIO(
'''
import sys, os
sys.path.insert(0, "/ruby/%s/www/%s/django-projects")
sys.path.insert(0, "/ruby/%s/www/%s/django-projects/project")
import django.core.handlers.wsgi
os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings'
application = django.core.handlers.wsgi.WSGIHandler()
''' % (user,host,user,host)), "remote-path", use_sudo=True)