Jump to content

Recommended Posts

Posted

I created a website using Django 1.5, and I managed to get it running on HelioHost!

Here's what I did, after following the instructions at http://www.heliohost...anguages/python...

 

First, I downloaded the Django-1.5.1.tar.gz file from the Django website.

 

Then, I extracted it and uploaded the Django-1.5.1/django/ folder to /home/username/django_1.5_override/django.

I also created an empty __init__ file in /home/username/django_1.5_override, to tell Python that it could import stuff from here. I'm not sure if it's needed, though.

 

I then added a few lines to the dispatch.wsgi file; the modifications are in the first 3 lines:

import os, sys
oldpath = sys.path
sys.path = ['/home/username/django_override/django-1.5.1/'] + oldpath
sys.path.append("/home/username/myapp");
os.environ['DJANGO_SETTINGS_MODULE'] = 'myapp.settings'
os.environ['PYTHON_EGG_CACHE'] = '/home/username/.python_egg_cache'
import django.core.handlers.wsgi
_application = django.core.handlers.wsgi.WSGIHandler();
def application(environ, start_response):
environ['PATH_INFO'] = environ['SCRIPT_NAME'] + environ['PATH_INFO'];
try: # added so that I can see errors if they occur; should be removed once the website is fully functional
return _application(environ, start_response)
except Exception, e:
	import traceback
	trace = traceback.format_exc()
	status = '500 Internal Server Error'
	output = trace
	response_headers = [('Content-type', 'text/plain'),('Content-Length', str(len(output)))]
	start_response(status, response_headers)
	return [output]

Basically, what I did was to add the Django 1.5.1 folder to the beginning of sys.path, so that when Python needs to import django, it imports my uploaded one instead of the default one.

 

After following these steps, Django 1.5.1 is running perfectly, and I can make use of all the new features! :D

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...