Code

Changes between Version 11 and Version 12 of webreusHowTo


Ignore:
Timestamp:
05/13/07 07:18:24 (7 years ago)
Author:
anonymous
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • webreusHowTo

    v11 v12  
    1111- mysqldb[[BR]] 
    1212- mod_python[[BR]] 
     13 
     14Make sure you ahve a PLESK 8.0 Environment. Ask the guys at the helpdesk ;) 
    1315 
    1416 
     
    3032 
    3133{{{ 
     34<Limit GET POST> 
     35order deny,allow 
     36deny from all 
     37allow from all 
     38</Limit> 
     39<Limit PUT DELETE> 
     40order deny,allow 
     41deny from all 
     42</Limit> 
    3243SetHandler python-program 
    3344AddHandler mod_python .py 
     45 
     46Header set Pragma "no-cache" 
     47Header set Cache-Control "no-cache" 
     48Header set Expires "-1" 
     49PythonPath "['/var/www/vhosts/<<yourdomain>>/httpdocs/django', '/var/www/vhosts/<<yourdomain>>/httpdocs/django/<<mysite>>'] + sys.path" 
    3450PythonHandler django.core.handlers.modpython 
    35 SetEnv DJANGO_SETTINGS_MODULE <yoursite>.settings 
    36 PythonDebug On 
     51SetEnv DJANGO_SETTINGS_MODULE <<mysite>>.settings 
     52PythonDebug On  
    3753}}} 
     54 
     55Setup the templates directory in your settings.py 
     56{{{ 
     57TEMPLATE_DIRS = ( 
     58    # Put strings here, like "/home/html/django_templates". 
     59    "/var/www/vhosts/<<yourdomain>>/httpdocs/django/<<mysite>>/templates" 
     60    # Always use forward slashes, even on Windows. 
     61) 
     62}}} 
     63 
     64And configure you urls.py 
     65{{{ 
     66from django.conf.urls.defaults import * 
     67 
     68urlpatterns = patterns('', 
     69    # Put application specific ones here.. 
     70 
     71    # Static serve sitemedia and admin media  
     72    (r'^sitemedia/(.*)$',  'django.views.static.serve', {'document_root': '/var/www/vhosts/<<yourdomain>>/httpdocs/django/<<mysite>>/media'}), 
     73    (r'^adminmedia/(.*)$',  'django.views.static.serve', {'document_root': '/var/www/vhosts/<<yourdomain>>/httpdocs/django/django/contrib/admin/media/'}), 
     74 
     75    # for admin: 
     76    (r'^admin/', include('django.contrib.admin.urls')), 
     77     
     78) 
     79 
     80}}} 
     81 
    3882 
    3983This suffices if django lives inside the httpdocs directory at webreus. For example as in the following setup: 
     
    4387 |  + django (which is the django source) 
    4488 |  + mysite (which is mysite's source) 
    45  + site-media 
     89 + sitemedia 
    4690}}} 
    4791 
    48 One user managed to get django to work from a directory outside httpdocs. Therefore the path to this folder is appended to the pythonpath. Add the following line to the .htaccess file: 
    49  
    50 {{{ 
    51 PythonPath "['???path/to/folder']+sys.path" 
    52 }}} 
    5392 
    5493== Home setup ==