Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/25/2014 in all areas

  1. Here's a zip file of a working example of django. http://area52.heliohost.org/djangotest.zip After you unzip the files, you'll see this file here: dispatch.wsgi You'll need to edit these two lines to match your site plus create the directory mentioned: import os, sys sys.path.append("/home1/area52/public_html/djangotest"); ### EDIT LINE ABOVE TO YOUR SITE ### os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' os.environ['PYTHON_EGG_CACHE'] = '/home1/area52/.python_egg_cache' ### YOU NEED TO CREATE THE DIRECTORY ABOVE WITH PERMISSIONS 777 ### If you've succeeded you'll see this: http://area52.heliohost.org/djangotest/
    1 point
  2. 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!
    1 point
×
×
  • Create New...