Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8074615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:42:50+00:00 2026-06-05T14:42:50+00:00

Dreamhost is a great host for small project. And it’s also Django friendly hosting.

  • 0

Dreamhost is a great host for small project. And it’s also Django friendly hosting. Everything good except python and Django version is a little bit out of date. Well it’s a whole day of work to figure out how to update Python 2.7.3, Django 1.4 on dreamhost and I really want to share with whoever finding it

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T14:42:52+00:00Added an answer on June 5, 2026 at 2:42 pm

    I currently have private server, a shell account and a bit of luck. So here is what I do:

    1. SSH to your host to upgrade python

       cd ~
       mkdir tmp
       cd tmp
       wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
       tar zxvf Python-2.7.3.tgz
       cd Python-2.7.3
       ./configure --enable-shared --prefix=$HOME/Python27 --enable-unicode=ucs4
       make
       make install
      
    2. Configure system to use our new Python. Open ~/.bashrc and add the following line

       export PATH="$HOME/Python27/bin:$PATH"
       export LD_LIBRARY_PATH=$HOME/Python27/lib
      
       #save it and run
       source ~/.bashrc
      

      you can now check your python version with which python

    3. Install easy_install, pip

      cd ~/tmp
      wget http://peak.telecommunity.com/dist/ez_setup.py
      python ez_setup.py
      easy_install pip
      # Or even shorter
      wget https://bootstrap.pypa.io/get-pip.py
      python get-pip.py
      
    4. Install virtualenv

       pip install virtualenv
       virtualenv $HOME/<site>/env
       #Switch to virtualenv
       source $HOME/<site>/env/bin/activate
      

      you can also add env path to bashrc

       export PATH="$HOME/<site>/env/bin/:$PATH"
       source ~/.bashrc
      
    5. Install django and everything else

       pip install django
       pip install ....
       pip install ....
       pip install ....
      
    6. Create project

       cd $HOME/<site>/
       python $HOME/<site>/env/bin/django-admin.py startproject project
      
    7. Create passenger_wsgi.py in HOME/<site>/ with following content

       import sys, os
       cwd = os.getcwd()
       sys.path.append(cwd)
       sys.path.append(cwd + '/project')  #You must add your project here or 500
      
       #Switch to new python
       #You may try to replace $HOME with your actual path
       if sys.version < "2.7.3": os.execl("$HOME/<site>/env/bin/python",
           "python2.7.3", *sys.argv)
      
       sys.path.insert(0,'$HOME/<site>/env/bin')
       sys.path.insert(0,'$HOME/<site>/env/lib/python2.7/site-packages/django')
       sys.path.insert(0,'$HOME/<site>/env/lib/python2.7/site-packages')
      
       os.environ['DJANGO_SETTINGS_MODULE'] = "project.settings"
       import django.core.handlers.wsgi
       application = django.core.handlers.wsgi.WSGIHandler()
      

    or this way

    import sys, os
    
    BASE_DIR = os.path.dirname(os.path.abspath(__file__))
    
    sys.path.append(os.path.join(BASE_DIR))  #You must add your project here or 500
    
    #Switch to new python
    #You may try to replace $HOME with your actual path
    PYTHON_PATH = os.path.join(BASE_DIR, 'env', 'bin', 'python')
    if sys.executable != PYTHON_PATH:
        os.execl(PYTHON_PATH, "python2.7.12", *sys.argv)
    

    If you are using django 1.7, replace the last two line with

    from django.core.wsgi import get_wsgi_application
    application = get_wsgi_application()
    
    1. Enjoy 😀

    New version of python on Dreamhost will no longer return sys.executable so you this is my version of passenger_wsgi

    import sys, os
    
    VIRTUAL_ENV_PYTHON = 'venv-python'  # Python > 2.7.6 dreamhost not return sys.executable
    BASE_DIR = os.path.dirname(os.path.abspath(__file__))
    
    def is_venv_python():
        if len(sys.argv) > 0:
            last_item = sys.argv[len(sys.argv)-1]
            if last_item == VIRTUAL_ENV_PYTHON:
                return True
        return False
    
    sys.path.append(os.path.join(BASE_DIR))  #You must add your project here or 500
    
    #Switch to new python
    
    PYTHON_PATH = os.path.join(BASE_DIR, 'env', 'bin', 'python')
    if not is_venv_python():
        os.execl(PYTHON_PATH, "python2.7.12", *sys.argv + [VIRTUAL_ENV_PYTHON])
    
    sys.path.insert(0, os.path.join(BASE_DIR, 'env', 'bin'))
    sys.path.insert(0, os.path.join(
        BASE_DIR, 'env', 'lib', 'python2.7', 'site-packages'
    ))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am hosting my Django application on Dreamhost. Dreamhost serves Django-1.2.1 on Python-2.5.2, but
I have Django project on Dreamhost server which has several views that returns Json
I am setting up an existing django project on a dreamhost web server, so
I just set up Django on a dreamhost server. Ran through everything, but can't
I'm currently on shared hosting plan with dreamhost and have installed Django as per
I'm trying to get a trivial Django project working with Passenger on Dreamhost, following
Update: Using Django 1.2.1 and Python 2.5.2 as offered by Dreamhost. I'm having issues
I had a Django site running on Dreamhost. Although I used SQLite when developing
I'm trying to install the Recess PHP framework on my web host (Dreamhost). It
I am using Django with Passenger on Dreamhost. Every time I make a change

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.