Code


Version 8 (modified by Joost Meijer <webmaster@…>, 8 years ago) (diff)

typo...

Setting up Django at Webreus.nl

Disclaimer

Webreus has contacted me again about their 'django' support. At this moment they do not support Django. As an experiment they have helped me out to run Django on the server where my website is hosted. Other servers do not have Python 2.2 and therefore do not support Django. Maybe, with their transition to Plesk8 they will support Django.

Introduction

Before I explain how you can setup Django on webreus.nl I should add a bit of context.

At the moment I'm in the process of creating a Django powered website. I was looking for the cheapest hosting I could find, as I do not think I'm pull too much traffic. Webreus is dirtcheap (just 10EUR a year) for the smallest package. For that price you get a lot, only no shell access.

Before I tried, they didn't have mod_python working properly (they ran python2.2), and did not have mysqldb. The kind people of webreus were able to set up both (mod_python now on python2.4), and my django setup works.

I'll quickly summarize how I got things working.

Home setup

First of all, I have a full django enabled webserver setup at home: running on windows XP with Uniform Server. I wanted to be able to test every aspect of Django at home with apache/mysql and mod_python.

One thing in this setup is out of the ordinary: Django is installed in the www part of filesystem, not in the python site_package directory. This will come in handy when things will be moved to webreus. I have django enabled through a .htaccess file:

SetHandler python-program
AddHandler mod_python .py
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE <yoursite>.settings
PythonDebug On

My directory structure is as follows

www
 + django
 |  + django (which is the django source)
 |  + mysite (which is mysite's source)
 + site-media

Setting all this up has been done by following the various installation guides.

Webreus 5 steps setup

  1. Have a working django setup at home (used for developing)
    I set up a system at home as described above. When this was all working I signed up with webreus. Within 2 days I had a new domain and all the information I needed. They run Plesk and do not provide shell access.
  2. Setup the databases on webreus
    Through Plesk databases can be setup, this involves following the Plesk manual. No rocket science at all, just some click work. In the end this gives you phpMyAdmin to configure (in my case) a mysql database. Make sure the database setup is the same as the 'home setup' (otherwise you'll just have to change the settings.py).
  3. Upload your files to webreus
    Then I uploaded all my local files, through a ftp upload to the 'httpdocs' directory. Again no rocket science.
  4. Import your development sql-export into the webreus database
    Now the main trick comes: without shell access there is no way to setup the database according to the 'models.py'. The way I've solved this is to replicate my home mysql database to webreus. Just exporting the database tables with contents through phpMyAdmin and uploading them again at webreus.
  5. Visit your website
    This was enough to get everything to work.

If you have any questions, just let me know: find my contact details in the history of this page.