1 # 2 # The following prevents a system from having installed and loaded on apache 3 # both mod_python and mod_wsgi 4 # 5 <IfModule mod_wsgi.c> 6 <IfModule mod_python.c> 7 ERROR__EITHER_MOD_WSGI_XOR_MOD_PYTHON_SHOULD_BE_ACTIVE 8 </IfModule> 9 </IfModule> 10 11 # 12 # Django, when running under mod_python, requires the prefork MPM, so just 13 # fail with this bogus directive if it's not loaded. For more info see: 14 # https://github.com/autotest/autotest/wiki/AutotestServerInstall 15 # 16 <IfModule !prefork.c> 17 <IfModule mod_python.c> 18 ERROR__DJANGO_REQUIRES_THE_PREFORK_MPM 19 </IfModule> 20 </IfModule> 21 22 RewriteEngine On 23 24 # 25 # Configuration on Moblab 26 # 27 RewriteCond /usr/lib64/python2.7/site-packages/django/contrib/admin/static/admin -d 28 RewriteRule ^/media/(css|img|js)(.*) /usr/lib64/python2.7/site-packages/django/contrib/admin/static/admin/$1/$2 29 RewriteCond /usr/lib64/python2.7/site-packages/django/contrib/admin/static/admin -d 30 RewriteRule ^/afe/server/admin/admin/(css|img|js)(.*) /usr/lib64/python2.7/site-packages/django/contrib/admin/static/admin/$1/$2 31 RewriteCond /usr/lib64/python2.7/site-packages/django/contrib/admin/static/admin -d 32 RewriteRule ^/afe/server/admin/afe/(aclgroup|atomicgroup|host|label|profiler|test)/admin/(css|img|js)(.*) /usr/lib64/python2.7/site-packages/django/contrib/admin/static/admin/$2/$3 33 34 # 35 # Django < 1.4 installed by utils/build_externals.py 36 # 37 RewriteCond /usr/local/autotest/site-packages/django/contrib/admin/media -d 38 RewriteRule ^/media/(css|img|js)(.*) /usr/local/autotest/site-packages/django/contrib/admin/media/$1/$2 39 RewriteCond /usr/local/autotest/site-packages/django/contrib/admin/media -d 40 RewriteRule ^/afe/server/admin/afe/(aclgroup|atomicgroup|host|label|profiler|test)/admin/(css|img|js)(.*) /usr/local/autotest/site-packages/django/contrib/admin/admin/$2/$3 41 42 # 43 # Django >= 1.4 installed by utils/build_externals.py 44 # Since it's not obvious: there's a change in the location of files 45 # 46 RewriteCond /usr/local/autotest/site-packages/django/contrib/admin/static/admin -d 47 RewriteRule ^/media/(css|img|js)(.*) /usr/local/autotest/site-packages/django/contrib/admin/static/admin/$1/$2 48 RewriteCond /usr/local/autotest/site-packages/django/contrib/admin/static/admin -d 49 RewriteRule ^/afe/server/admin/admin/(css|img|js)(.*) /usr/local/autotest/site-packages/django/contrib/admin/static/admin/$1/$2 50 RewriteCond /usr/local/autotest/site-packages/django/contrib/admin/static/admin -d 51 RewriteRule ^/afe/server/admin/afe/(aclgroup|atomicgroup|host|label|profiler|test)/admin/(css|img|js)(.*) /usr/local/autotest/site-packages/django/contrib/admin/static/admin/$2/$3 52 53 # 54 # Python 2.7 and django >= 1.4 installed by distributions packages 55 # 56 RewriteCond /usr/lib/python2.7/site-packages/django/contrib/admin/static/admin -d 57 RewriteRule ^/media/(css|img|js)(.*) /usr/lib/python2.7/site-packages/django/contrib/admin/static/admin/$1/$2 58 RewriteCond /usr/lib/python2.7/site-packages/django/contrib/admin/static/admin -d 59 RewriteRule ^/afe/server/admin/afe/(aclgroup|atomicgroup|host|label|profiler|test)/admin/(css|img|js)(.*) /usr/lib/python2.7/site-packages/django/contrib/admin/static/admin/$2/$3 60 61 # 62 # Python 2.7 and django < 1.4 installed by distributions packages 63 # 64 RewriteCond /usr/lib/python2.7/site-packages/django/contrib/admin/media -d 65 RewriteRule ^/media/(css|img|js)(.*) /usr/lib/python2.7/site-packages/django/contrib/admin/media/$1/$2 66 RewriteCond /usr/lib/python2.7/site-packages/django/contrib/admin/media -d 67 RewriteRule ^/afe/server/admin/afe/(aclgroup|atomicgroup|host|label|profiler|test)/admin/(css|img|js)(.*) /usr/lib/python2.7/site-packages/django/contrib/admin/admin/$2/$3 68 69 # 70 # Python 2.6 and django < 1.4 installed by distributions packages 71 # 72 RewriteCond /usr/lib/python2.6/site-packages/django/contrib/admin/media -d 73 RewriteRule ^/media/(css|img|js)(.*) /usr/lib/python2.6/site-packages/django/contrib/admin/media/$1/$2 74 RewriteCond /usr/lib/python2.6/site-packages/django/contrib/admin/media -d 75 RewriteRule ^/afe/server/admin/afe/(aclgroup|atomicgroup|host|label|profiler|test)/admin/(css|img|js)(.*) /usr/lib/python2.6/site-packages/django/contrib/admin/admin/$2/$3 76 77 # 78 # Python 2.5 and django < 1.4 installed by distributions packages 79 # 80 RewriteCond /usr/lib/python2.5/site-packages/django/contrib/admin/media -d 81 RewriteRule ^/media/(css|img|js)(.*) /usr/lib/python2.5/site-packages/django/contrib/admin/media/$1/$2 82 RewriteCond /usr/lib/python2.5/site-packages/django/contrib/admin/media -d 83 RewriteRule ^/afe/server/admin/afe/(aclgroup|atomicgroup|host|label|profiler|test)/admin/(css|img|js)(.*) /usr/lib/python2.5/site-packages/django/contrib/admin/admin/$2/$3 84 85 # 86 # Python 2.4 and django < 1.4 installed by distributions packages 87 # 88 RewriteCond /usr/lib/python2.4/site-packages/django/contrib/admin/media -d 89 RewriteRule ^/media/(css|img|js)(.*) /usr/lib/python2.4/site-packages/django/contrib/admin/media/$1/$2 90 RewriteCond /usr/lib/python2.4/site-packages/django/contrib/admin/media -d 91 RewriteRule ^/afe/server/admin/afe/(aclgroup|atomicgroup|host|label|profiler|test)/admin/(css|img|js)(.*) /usr/lib/python2.4/site-packages/django/contrib/admin/admin/$2/$3 92 93 # 94 # Generic Python shared dir and django < 1.4 installed by Debian like packages 95 # 96 RewriteCond /usr/share/pyshared/django/contrib/admin/media -d 97 RewriteRule ^/media/(css|img|js)(.*) /usr/share/pyshared/django/contrib/admin/media/$1/$2 98 RewriteCond /usr/share/pyshared/django/contrib/admin/media -d 99 RewriteRule ^/afe/server/admin/afe/(aclgroup|atomicgroup|host|label|profiler|test)/admin/(css|img|js)(.*) /usr/share/pyshared/django/contrib/admin/media$2/$3 100 101 # 102 # Configuration for mod_wsgi 103 # 104 <IfModule mod_wsgi.c> 105 106 RewriteCond /usr/local/autotest/frontend/frontend.wsgi -f 107 RewriteRule ^/(afe|new_tko)/server(.*) /usr/local/autotest/frontend/frontend.wsgi [H=wsgi-script] 108 109 RewriteCond /usr/lib/python2.7/site-packages/autotest/frontend/frontend.wsgi -f 110 RewriteRule ^/(afe|new_tko)/server(.*) /usr/lib/python2.7/site-packages/autotest/frontend/frontend.wsgi [H=wsgi-script] 111 112 RewriteCond /usr/lib/python2.6/site-packages/autotest/frontend/frontend.wsgi -f 113 RewriteRule ^/(afe|new_tko)/server(.*) /usr/lib/python2.6/site-packages/autotest/frontend/frontend.wsgi [H=wsgi-script] 114 115 RewriteCond /usr/lib/python2.5/site-packages/autotest/frontend/frontend.wsgi -f 116 RewriteRule ^/(afe|new_tko)/server(.*) /usr/lib/python2.5/site-packages/autotest/frontend/frontend.wsgi [H=wsgi-script] 117 118 RewriteCond /usr/lib/python2.4/site-packages/autotest/frontend/frontend.wsgi -f 119 RewriteRule ^/(afe|new_tko)/server(.*) /usr/lib/python2.4/site-packages/autotest/frontend/frontend.wsgi [H=wsgi-script] 120 121 <LocationMatch "/(afe|new_tko)/server(.*)"> 122 Options +ExecCGI 123 </LocationMatch> 124 125 WSGISocketPrefix /var/run/wsgi 126 WSGIDaemonProcess autotestapache processes=20 threads=1 127 WSGIProcessGroup autotestapache 128 WSGIPassAuthorization On 129 </IfModule> 130 131 # 132 # Configuration for mod_python 133 # 134 <IfModule mod_python.c> 135 <Location ~ "/(afe|new_tko)/server"> 136 SetHandler python-program 137 PythonHandler django.core.handlers.modpython 138 SetEnv DJANGO_SETTINGS_MODULE frontend.settings 139 PythonDebug On 140 # Force our own site-packages to be loaded by mod_python prior to 141 # mod_python's system python site-packages directory. 142 # This way our code can depend on library versions other than 143 # those available as packages on various OS distributions. 144 PythonPath "['/usr/local/autotest/site-packages', '/usr/local/autotest', '/usr/lib/python2.7/site-packages/autotest', '/usr/lib/python2.6/site-packages/autotest', '/usr/lib/python2.5/site-packages/autotest', '/usr/lib/python2.4/site-packages/autotest'] + sys.path" 145 </Location> 146 </IfModule> 147