Set up Django on a Remote Host

I was able  to set up the Django sample site on my Dreamhost site. Django is a high-level Python Web framework that facilitates rapid web application development. I was able to follow the Django tutorial and instruction from Dreamhost to add a Django site to my domain.


First I setup my local environment (Python 3.4 and Django 1.6.5) and created a polls app by following the wonderful Django tutorials.

https://docs.djangoproject.com/en/1.6/intro

After testing the polls app locally using the development server, I was ready to put the simple app online.

Then I set up the remote environment on my ShallWeLearn domain by following this instruction

http://wiki.dreamhost.com/Django

My directory looks as followed:

$HOME//
              env/
              mysite/
              passenger_wgi.py
              public
              static 

And my passenger_wgit.py file looks as followed:

    import sys, os
    cwd = os.getcwd()
    sys.path.append(cwd)
    sys.path.append(cwd + '/mysite')
    sys.path.insert(0,cwd+'/env/bin')
    sys.path.insert(0,cwd+'/env/lib/python3.4/site-packages/django')
    sys.path.insert(0,cwd+'/env/lib/python3.4/site-packages')

    os.environ['DJANGO_SETTINGS_MODULE'] = "mysite.settings"
    import django.core.handlers.wsgi
    application = django.core.handlers.wsgi.WSGIHandler()

To visit the finished site, go to http://rave.shallwelearn.com/polls. To go to admin page http://rave.shallwelearn.com/admin

The imagine below shows the admin page of Polls App:

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply