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|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|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|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|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|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|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|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|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|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 # Note: this maximum-requests argument is required because of a memory leak in the django admin pages. 127 # The WSGIDaemonProcess directive prevents mpm_prefork from recycling the 128 # memory that Django uses, as it is tied up in the daemon. We can prevent 129 # the autotest memory leak from biting us by setting maximum-requests, 130 # which will recycle each daemon process after it gets a certain number of 131 # web requests. 132 WSGIDaemonProcess autotestapache processes=40 threads=1 maximum-requests=200 133 WSGIProcessGroup autotestapache 134 WSGIPassAuthorization On 135 </IfModule> 136 137 # 138 # Configuration for mod_python 139 # 140 <IfModule mod_python.c> 141 <Location ~ "/(afe|new_tko)/server"> 142 SetHandler python-program 143 PythonHandler django.core.handlers.modpython 144 SetEnv DJANGO_SETTINGS_MODULE frontend.settings 145 PythonDebug On 146 # Force our own site-packages to be loaded by mod_python prior to 147 # mod_python's system python site-packages directory. 148 # This way our code can depend on library versions other than 149 # those available as packages on various OS distributions. 150 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" 151 </Location> 152 </IfModule> 153