Version 12 (modified by anonymous, 7 years ago) (diff)


Setting up Django at


Webreus does not support Django, however it is possible to get django running. This article contains the combined experience of two WebReus users. At the moment, the following setup is tested and possible:

  • Django 0.95 (other versions presumed to be working as well)
  • Python 2.4 (current version installed at webReus)
  • mysqldb
  • mod_python

Make sure you ahve a PLESK 8.0 Environment. Ask the guys at the helpdesk ;)

Since no official support is given, there is no guarantee that this setup wil work in the future.


As mentioned, two users have succeeded in getting django to work at Their setups differ somewhat, as does the scope of their projects. This article will bear the fruits of their combined labour.

The common reason for choosing Webreus is bang (full package, but no shell access) for buck (just 10EUR a year), and the prospect of a django powered site.

Some early support for django from the kind people at webreus has resulted in the current setup: mod_python on python2.4. Despite the current lack of support considering django, it is still possible to get started with a django site.

A quick summary on how things get working.

Remote setup

To get things working remotely, it is necessary to copy the django folder to the webserver. Ergo, remotely it does not live inside python site_packages directory. Django is enabled through a .htaccess file in the directories where django should handle the .py files:

<Limit GET POST>
order deny,allow
deny from all
allow from all
order deny,allow
deny from all
SetHandler python-program
AddHandler mod_python .py

Header set Pragma "no-cache"
Header set Cache-Control "no-cache"
Header set Expires "-1"
PythonPath "['/var/www/vhosts/<<yourdomain>>/httpdocs/django', '/var/www/vhosts/<<yourdomain>>/httpdocs/django/<<mysite>>'] + sys.path"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE <<mysite>>.settings
PythonDebug On 

Setup the templates directory in your

    # Put strings here, like "/home/html/django_templates".
    # Always use forward slashes, even on Windows.

And configure you

from django.conf.urls.defaults import *

urlpatterns = patterns('',
    # Put application specific ones here..

    # Static serve sitemedia and admin media 
    (r'^sitemedia/(.*)$',  'django.views.static.serve', {'document_root': '/var/www/vhosts/<<yourdomain>>/httpdocs/django/<<mysite>>/media'}),
    (r'^adminmedia/(.*)$',  'django.views.static.serve', {'document_root': '/var/www/vhosts/<<yourdomain>>/httpdocs/django/django/contrib/admin/media/'}),

    # for admin:
    (r'^admin/', include('django.contrib.admin.urls')),

This suffices if django lives inside the httpdocs directory at webreus. For example as in the following setup:

 + django
 |  + django (which is the django source)
 |  + mysite (which is mysite's source)
 + sitemedia

Home setup

A fully django enabled webserver setup at home: running on windows XP / 2K with Uniform Server and mod_python. To be able to test every aspect of Django at home with apache/mysql and mod_python. A pgSQL-python interface is not present at webreus, so this rules postgreSQL out for django use.

To replicate the remote server fully, it is possible to install django to the www/ part of your local webserver. Just move the django folder from site_packages to wherever you want it. Adjust both system variables Pythonpath and Path accordingly and Bob's your uncle. Presumably it is not necessary to relocate Django locally.

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)
    Set up a system at home as described above. Sign up with webreus. Please note that Webreus does NOT support Django (see the Disclaimer on top of this page). 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 set up, this involves following the Plesk manual. No rocket science at all, just some click work. In the end this gives you phpMyAdmin to configure a mysql database. Make sure the database setup is the same as the 'home setup' (otherwise you'll just have to change the
  3. Upload your files to webreus
    Upload all 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 ''. 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: you can find both users' contact details in the history of this page.