diff options
author | Ken Raffenetti <raffenet@mcs.anl.gov> | 2006-11-30 20:13:52 +0000 |
---|---|---|
committer | Ken Raffenetti <raffenet@mcs.anl.gov> | 2006-11-30 20:13:52 +0000 |
commit | 2c2766fe6d404b63729d34874aa0b18a87dd7d43 (patch) | |
tree | e01933b17a291f7a329ca535e2f14b11b5c2362c /src/lib/Server | |
parent | d8a9236ec2fd511bf29980fcc43155629b49ff88 (diff) | |
download | bcfg2-2c2766fe6d404b63729d34874aa0b18a87dd7d43.tar.gz bcfg2-2c2766fe6d404b63729d34874aa0b18a87dd7d43.tar.bz2 bcfg2-2c2766fe6d404b63729d34874aa0b18a87dd7d43.zip |
tweaks for a more standard installation
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2554 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server')
-rw-r--r-- | src/lib/Server/Hostbase/hostbase/models.py | 2 | ||||
-rw-r--r-- | src/lib/Server/Hostbase/hostbase/views.py | 104 | ||||
-rw-r--r-- | src/lib/Server/Hostbase/hostbase/webtemplates/edit.html | 169 | ||||
-rw-r--r-- | src/lib/Server/Hostbase/hostbase/webtemplates/errors.html | 4 | ||||
-rw-r--r-- | src/lib/Server/Hostbase/hostbase/webtemplates/host.html | 4 | ||||
-rw-r--r-- | src/lib/Server/Hostbase/nisauth.py | 2 | ||||
-rw-r--r-- | src/lib/Server/Hostbase/settings.py | 10 | ||||
-rw-r--r-- | src/lib/Server/Hostbase/urls.py | 12 |
8 files changed, 128 insertions, 179 deletions
diff --git a/src/lib/Server/Hostbase/hostbase/models.py b/src/lib/Server/Hostbase/hostbase/models.py index 4c29c8178..dbb63cc3a 100644 --- a/src/lib/Server/Hostbase/hostbase/models.py +++ b/src/lib/Server/Hostbase/hostbase/models.py @@ -44,7 +44,7 @@ class Host(models.Model): security_class = models.CharField('class', maxlength=16) support = models.CharField(maxlength=8, choices=SUPPORT_CHOICES) csi = models.CharField(maxlength=32, blank=True) - printq = models.CharField(maxlength=32) + printq = models.CharField(maxlength=32, blank=True) outbound_smtp = models.BooleanField() primary_user = models.EmailField() administrator = models.EmailField(blank=True) diff --git a/src/lib/Server/Hostbase/hostbase/views.py b/src/lib/Server/Hostbase/hostbase/views.py index 241c01296..35f1ede32 100644 --- a/src/lib/Server/Hostbase/hostbase/views.py +++ b/src/lib/Server/Hostbase/hostbase/views.py @@ -9,13 +9,13 @@ from django.http import HttpResponse, HttpResponseRedirect from django.contrib.auth.decorators import login_required from django.contrib.auth import logout -from Hostbase.hostbase.models import * +from Bcfg2.Server.Hostbase.hostbase.models import * from datetime import date from django.db import connection from django.shortcuts import render_to_response from django import forms -from Hostbase import settings, regex -import re +from Bcfg2.Server.Hostbase import settings, regex +import dns, re attribs = ['hostname', 'whatami', 'netgroup', 'security_class', 'support', 'csi', 'printq', 'primary_user', 'administrator', 'location', @@ -153,34 +153,26 @@ def fill(template, hostdata, dnsdata=False): return template def edit(request, host_id): - """Edit general host information - Data is validated before being committed to the database""" - # fix bug when ip address changes, update the dns info appropriately + """Edit general host information""" + manipulator = Host.ChangeManipulator(host_id) changename = False - if request.GET.has_key('sub'): + if request.method == 'POST': host = Host.objects.get(id=host_id) if request.POST['hostname'] != host.hostname: oldhostname = host.hostname.split(".")[0] - host.hostname = request.POST['hostname'] - host.save() changename = True interfaces = host.interface_set.all() - if not validate(request, False, host_id): - if (request.POST.has_key('outbound_smtp') - and not host.outbound_smtp or - not request.POST.has_key('outbound_smtp') - and host.outbound_smtp): - host.outbound_smtp = not host.outbound_smtp - # add validation for attribs here - # likely use a helper fucntion - for attrib in attribs: - if request.POST.has_key(attrib): - host.__dict__[attrib] = request.POST[attrib].lower() - if request.POST.has_key('comments'): - host.comments = request.POST['comments'] - if len(request.POST['expiration_date'].split("-")) == 3: - (year, month, day) = request.POST['expiration_date'].split("-") - host.expiration_date = date(int(year), int(month), int(day)) + new_data = request.POST.copy() + + errors = manipulator.get_validation_errors(new_data) + if not errors: + + # somehow keep track of multiple interface change manipulators + # as well as multiple ip chnage manipulators??? (add manipulators???) + # change to many-to-many?????? + + # dynamically look up mx records? + for inter in interfaces: changetype = False ips = IP.objects.filter(interface=inter.id) @@ -298,7 +290,7 @@ def edit(request, host_id): return HttpResponseRedirect('/hostbase/%s/' % host.id) else: return render_to_response('errors.html', - {'failures': validate(request, False, host_id), + {'failures': errors, 'logged_in': request.session.get('_auth_user_id', False)}) else: host = Host.objects.get(id=host_id) @@ -676,19 +668,19 @@ def validate(request, new=False, host_id=None): and regex.host.match(request.POST['hostname'])): failures.append('hostname') - if not regex.printq.match(request.POST['printq']) and request.POST['printq']: - failures.append('printq') +## if not regex.printq.match(request.POST['printq']) and request.POST['printq']: +## failures.append('printq') - if not regex.user.match(request.POST['primary_user']): - failures.append('primary_user') +## if not regex.user.match(request.POST['primary_user']): +## failures.append('primary_user') - if (not regex.user.match(request.POST['administrator']) - and request.POST['administrator']): - failures.append('administrator') +## if (not regex.user.match(request.POST['administrator']) +## and request.POST['administrator']): +## failures.append('administrator') - if not (request.POST['location'] - and regex.location.match(request.POST['location'])): - failures.append('location') +## if not (request.POST['location'] +## and regex.location.match(request.POST['location'])): +## failures.append('location') if new: if (not regex.macaddr.match(request.POST['mac_addr_new']) @@ -787,11 +779,12 @@ def zonenew(request): nsform = forms.FormWrapper(nsmanipulator, {}, {}) mxform = forms.FormWrapper(mxmanipulator, {}, {}) aform = forms.FormWrapper(addressmanipulator, {}, {}) - return render_to_response('zonenew.html', {'form': form, - 'nsform': nsform, - 'mxform': mxform, - 'aform': aform, - }) + context = {'form': form, + 'nsform': nsform, + 'mxform': mxform, + 'aform': aform, + } + return render_to_response('zonenew.html', context) def zoneedit(request, zone_id): manipulator = Zone.ChangeManipulator(zone_id) @@ -799,9 +792,11 @@ def zoneedit(request, zone_id): mxaddmanipulator = MX.AddManipulator() addressaddmanipulator = ZoneAddress.AddManipulator() zone = manipulator.original_object - nsmanipulators = [Nameserver.ChangeManipulator(ns.id) for ns in zone.nameservers.all()] + nsmanipulators = [Nameserver.ChangeManipulator(ns.id) + for ns in zone.nameservers.all()] mxmanipulators = [MX.ChangeManipulator(mx.id) for mx in zone.mxs.all()] - addressmanipulators = [ZoneAddress.ChangeManipulator(address.id) for address in zone.addresses.all()] + addressmanipulators = [ZoneAddress.ChangeManipulator(address.id) + for address in zone.addresses.all()] if request.method == 'POST': new_data = request.POST.copy() new_data['serial'] = str(zone.serial) @@ -820,16 +815,17 @@ def zoneedit(request, zone_id): nsforms = [forms.FormWrapper(nsm, nsm.flatten_data(), {}) for nsm in nsmanipulators] mxforms = [forms.FormWrapper(mxm, mxm.flatten_data(), {}) for mxm in mxmanipulators] aforms = [forms.FormWrapper(am, am.flatten_data(), {}) for am in addressmanipulators] - return render_to_response('zoneedit.html', {'form': form, - 'nsforms': nsforms, - 'mxforms': mxforms, - 'aforms': aforms, - 'nsadd': forms.FormWrapper(nsaddmanipulator, {}, {}), - 'mxadd': forms.FormWrapper(mxaddmanipulator, {}, {}), - 'addadd': forms.FormWrapper(addressaddmanipulator, {}, {}), - 'zone_id': zone_id, - 'zone': zone.zone - }) + context = {'form': form, + 'nsforms': nsforms, + 'mxforms': mxforms, + 'aforms': aforms, + 'nsadd': forms.FormWrapper(nsaddmanipulator, {}, {}), + 'mxadd': forms.FormWrapper(mxaddmanipulator, {}, {}), + 'addadd': forms.FormWrapper(addressaddmanipulator, {}, {}), + 'zone_id': zone_id, + 'zone': zone.zone + } + return render_to_response('zoneedit.html', context) def do_zone_add(manipulator, new_data): manipulator.do_html2python(new_data) @@ -857,7 +853,7 @@ def check_zone_errors(new_data): priorities = new_data.getlist('priority') count = 0 for mx in new_data.getlist('mx'): - errors.update(MX.AddManipulator().get_validation_errors({'mx':mx, 'priority':priorities[0]})) + errors.update(MX.AddManipulator().get_validation_errors({'mx':mx, 'priority':priorities[count]})) count += 1 return errors diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/edit.html b/src/lib/Server/Hostbase/hostbase/webtemplates/edit.html index d3bb848ca..297a3860b 100644 --- a/src/lib/Server/Hostbase/hostbase/webtemplates/edit.html +++ b/src/lib/Server/Hostbase/hostbase/webtemplates/edit.html @@ -45,16 +45,12 @@ div#interface{ } </style> -<form name="hostdata" action="?sub=true" method="post"> +<form name="hostdata" action="" method="post"> +<fieldset class="module aligned ()"> <input type="hidden" name="host" value="{{ host.id }}"> -<table border="0" width="100%"> - <colgroup> - <col width="150"> - <col width="*"> - <tr> <td> <b>hostname</b></td> - <td> <input name="hostname" value="{{ host.hostname }}"></td></tr> - <tr> <td> <b>whatami</b></td> - <td> + <label for="id_hostname">hostname:</label> + <input name="hostname" value="{{ host.hostname }}"><br> + <label for="id_whatami">whatami:</label> <select name="whatami"> {% for choice in host.WHATAMI_CHOICES %} {% ifequal host.whatami choice.0 %} @@ -63,9 +59,8 @@ div#interface{ <option value="{{ choice.0 }}">{{ choice.1 }} {% endifequal %} {% endfor %} - </select></td></tr> - <tr> <td> <b>netgroup</b></td> - <td> + </select><br> + <label for="id_netgroup">netgroup:</label> <select name="netgroup"> {% for choice in host.NETGROUP_CHOICES %} {% ifequal host.netgroup choice.0 %} @@ -74,10 +69,8 @@ div#interface{ <option value="{{ choice.0 }}">{{ choice.1 }} {% endifequal %} {% endfor %} - </select> - </td></tr> - <tr> <td> <b>class</b></td> - <td> + </select><br> + <label for="id_security_class">class:</label> <select name="security_class"> {% for choice in host.CLASS_CHOICES %} {% ifequal host.security_class choice.0 %} @@ -86,9 +79,8 @@ div#interface{ <option value="{{ choice.0 }}">{{ choice.1 }} {% endifequal %} {% endfor %} - </select></td></tr> - <tr> <td> <b>support</b></td> - <td> + </select><br> + <label for="id_support">support:</label> <select name="support"> {% for choice in host.SUPPORT_CHOICES %} {% ifequal host.support choice.0 %} @@ -97,113 +89,87 @@ div#interface{ <option value="{{ choice.0 }}">{{ choice.1 }} {% endifequal %} {% endfor %} - </select></td></tr> - <tr> <td> <b>csi</b></td> - <td> <input name="csi" type="text" value="{{ host.csi }}"></td></tr> - <tr> <td> <b>printq</b></td> - <td> <input name="printq" type="text" value="{{ host.printq }}"></td></tr> - <tr> <td> <b>outbound_smtp</b></td> - <td> + </select><br> + <label for="id_csi">csi:</label> + <input name="csi" type="text" value="{{ host.csi }}"><br> + <label for="id_printq">printq:</label> + <input name="printq" type="text" value="{{ host.printq }}"><br> + <label for="id_outbound_smtp">outbound_smtp:</label> {% if host.outbound_smtp %} - <input type="checkbox" checked="checked" name="outbound_smtp"></td></tr> + <input type="checkbox" checked="checked" name="outbound_smtp"> {% else %} - <input type="checkbox" name="outbound_smtp"></td></tr> - {% endif %} - <tr> <td> <b>primary_user</b></td> - <td> <input name="primary_user" type="text" size="32" value="{{ host.primary_user }}"></td></tr> - <tr> <td> <b>administrator</b></td> - <td> <input name="administrator" type="text" size="32" value="{{ host.administrator }}"></td></tr> - <tr> <td> <b>location</b></td> - <td> <input name="location" type="text" value="{{ host.location }}"></td></tr> - <tr> <td> <b>expiration_date</b></td> - <td> <input name="expiration_date" type="text" value="{{ host.expiration_date }}"> YYYY-MM-DD</td></tr> + <input type="checkbox" name="outbound_smtp"> + {% endif %}<br> + <label for="id_primary_user">primary_user:</label> + <input name="primary_user" type="text" size="32" value="{{ host.primary_user }}"><br> + <label for="id_administrator">administrator:</label> + <input name="administrator" type="text" size="32" value="{{ host.administrator }}"><br> + <label for="id_location">location:</label> + <input name="location" type="text" value="{{ host.location }}"><br> + <label for="id_expiration_date">expiration_date:</label> + <input name="expiration_date" type="text" value="{{ host.expiration_date }}"> YYYY-MM-DD<br> {% for interface in interfaces %} - <tr> <td><br><b>Interface</b> - </td><td><br> - {% for choice in interface.0.TYPE_CHOICES %} - {% ifequal interface.0.hdwr_type choice.0 %} - <input type="radio" name="hdwr_type{{ interface.0.id }}" value="{{ choice.0 }}" checked="checked">{{ choice.1 }} - {% else %} - <input type="radio" name="hdwr_type{{ interface.0.id }}" value="{{ choice.0 }}">{{ choice.1 }} - {% endifequal %} - {% endfor %} - </td></tr> - <tr> <td> <b>dhcp</b></td> - <td> + <label for="id_interface">Interface:</label> + <select name="hdwr_type{{ interface.0.id }}"> + {% for choice in interface.0.TYPE_CHOICES %} + {% ifequal interface.0.hdwr_type choice.0 %} + <option value="{{ choice.0 }}" selected="selected">{{ choice.1 }} + {% else %} + <option value="{{ choice.0 }}">{{ choice.1 }} + {% endifequal %} + {% endfor %} + </select><br> + <label for="id_dhcp">dhcp:</label> {% if interface.0.dhcp %} - <input type="checkbox" checked="checked" name="dhcp{{ interface.0.id }}"></td></tr> + <input type="checkbox" checked="checked" name="dhcp{{ interface.0.id }}"> {% else %} - <input type="checkbox" name="dhcp{{ interface.0.id }}"></td></tr> - {% endif %} - <tr> <td> <b>mac_addr</b></td> - <td> <input name="mac_addr{{ interface.0.id }}" type="text" value="{{ interface.0.mac_addr }}"> - <a style="font-size:75%" href="/hostbase/{{ host.id }}/interface/{{ interface.0.id }}/confirm">remove</a> - </td></tr> + <input type="checkbox" name="dhcp{{ interface.0.id }}"> + {% endif %}<br> + <label for="id_mac_addr">mac_addr:</label> + <input name="mac_addr{{ interface.0.id }}" type="text" value="{{ interface.0.mac_addr }}"> + <a style="font-size:75%" href="/hostbase/{{ host.id }}/interface/{{ interface.0.id }}/confirm">remove</a><br> {% for ip in interface.1 %} - <tr> <td> <b>ip_addr</b> - </td> - <td> <input name="ip_addr{{ ip.id }}" type="text" value="{{ ip.ip_addr }}"> - <a style="font-size:75%" href="/hostbase/{{ host.id }}/ip/{{ ip.id }}/confirm">remove - </a></td></tr> + <label for="id_ip_addr">ip_addr:</label> + <input name="ip_addr{{ ip.id }}" type="text" value="{{ ip.ip_addr }}"> + <a style="font-size:75%" href="/hostbase/{{ host.id }}/ip/{{ ip.id }}/confirm">remove</a><br> {% endfor %} <!-- Section for adding a new IP address to an existing interface --> <!-- By default, section is hidden --> - </table> <div id=ipaddr{{ interface.0.id }}> - <table border="0" width="100%"> - <colgroup> - <col width="150"> - <col width="*"> - <tr> <td> <b>ip_addr</b></td> - <td> <input name="{{ interface.0.id }}ip_addr" type="text"></td></tr> - </table> + <label for="id_ip_addr">ip_addr:</label> + <input name="{{ interface.0.id }}ip_addr" type="text"><br> </div> - <a style="font-size:75%" href=# onclick="toggleAddr({{ interface.0.id }})">Add a New IP Address</a> - <table border="0" width="100%"> - <colgroup> - <col width="150"> - <col width="*"> + <a style="font-size:75%" href=# onclick="toggleAddr({{ interface.0.id }})">Add a New IP Address</a><br> {% endfor %} <!-- End section for new IP address --> <!-- Section for add an entirely new interface to a host --> <!-- By default, section is hidden --> - </table> <div id=interface> - <table border="0" width="100%"> - <colgroup> - <col width="150"> - <col width="*"> - <tr> <td><br><b>Interface</b></td><td><br> + <label for="id_interface">Interface:</label> + <select name="hdwr_type{{ interface.0.id }}"> {% for choice in TYPE_CHOICES %} - <input type="radio" name="hdwr_type_new" value="{{ choice.0 }}">{{ choice.1 }} + <option value="{{ choice.0 }}">{{ choice.1 }} {% endfor %} - </td></tr> - <tr> <td> <b>dhcp</b></td> - <td> + </select><br> + <label for="id_dhcp">dhcp:</label> {% if host.dhcp %} - <input type="checkbox" checked="checked" name="dhcp_new"></td></tr> + <input type="checkbox" checked="checked" name="dhcp_new"> {% else %} - <input type="checkbox" name="dhcp_new"></td></tr> - {% endif %} - <tr> <td> <b>mac_addr</b></td> - <td> <input name="mac_addr_new" type="text"></td></tr> - <tr> <td> <b>ip_addr</b></td> - <td> <input name="ip_addr_new" type="text"></td></tr> -</table> + <input type="checkbox" name="dhcp_new"> + {% endif %}<br> + <label for="id_mac_addr">mac_addr:</label> + <td> <input name="mac_addr_new" type="text"><br> + <label for="id_ip_addr">ip_addr:</label> + <td> <input name="ip_addr_new" type="text"><br> </div> -<a style="font-size:75%" href=# onclick="toggleInter()">Add a New Interface</a> +<a style="font-size:75%" href=# onclick="toggleInter()">Add a New Interface</a><br> <!-- End new interface section --> -<table border="0" width="100%"> - <colgroup> - <col width="150"> - <col width="*"> -<tr> <td> <b>comments</b></td> -<td> <textarea rows="10" cols="50" name="comments">{{ host.comments }}</textarea></td></tr> -</table> +<label for="id_comments">comments:</label> +<textarea rows="10" cols="50" name="comments">{{ host.comments }}</textarea><br> <a style="font-size:75%" href="/hostbase/{{ host.id }}/dns/edit">edit detailed DNS information for this host</a> <br> this host is @@ -217,7 +183,8 @@ this host is {% endfor %} </select><br> last update on {{ host.last }}<br> -<p><input type="submit" value="Submit"> +<input type="submit" value="submit"> +<input type="reset" value="cancel" onclick="history.back()"> </form> {% endblock %} diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/errors.html b/src/lib/Server/Hostbase/hostbase/webtemplates/errors.html index 724bf9c34..46050d941 100644 --- a/src/lib/Server/Hostbase/hostbase/webtemplates/errors.html +++ b/src/lib/Server/Hostbase/hostbase/webtemplates/errors.html @@ -16,9 +16,9 @@ {% if failures %} There were errors in the following fields<br><br> -{% for failure in failures %} +{% for failure in failures.items %} -<font color="#FF0000">{{ failure }}</font><br> +<font color="#FF0000">{{ failure.0 }}: {{ failure.1|join:", " }}</font><br> {% endfor %} {% endif %} diff --git a/src/lib/Server/Hostbase/hostbase/webtemplates/host.html b/src/lib/Server/Hostbase/hostbase/webtemplates/host.html index 39cdc7ae4..75cac61db 100644 --- a/src/lib/Server/Hostbase/hostbase/webtemplates/host.html +++ b/src/lib/Server/Hostbase/hostbase/webtemplates/host.html @@ -56,13 +56,9 @@ {% ifnotequal interface.0.hdwr_type 'no' %} <td><br>{{ interface.0.hdwr_type }}</td></tr> {% endifnotequal %} - <tr> <td> <b>dhcp</b></td> {% if interface.0.dhcp %} - <td> y </td></tr> <tr> <td> <b>mac_addr</b></td> <td> {{ interface.0.mac_addr }}</b></td></tr> - {% else %} - <td> n </td></tr> {% endif %} {% for ip in interface.1 %} <tr> <td> <b>ip_addr</b></td> diff --git a/src/lib/Server/Hostbase/nisauth.py b/src/lib/Server/Hostbase/nisauth.py index 9c68c44eb..9bce9511f 100644 --- a/src/lib/Server/Hostbase/nisauth.py +++ b/src/lib/Server/Hostbase/nisauth.py @@ -1,6 +1,6 @@ import os import crypt, nis -from Hostbase.settings import AUTHORIZED_GROUP +from Bcfg2.Server.Hostbase.settings import AUTHORIZED_GROUP """Checks with NIS to see if the current user is in the support group""" diff --git a/src/lib/Server/Hostbase/settings.py b/src/lib/Server/Hostbase/settings.py index de319ca0b..047b330b4 100644 --- a/src/lib/Server/Hostbase/settings.py +++ b/src/lib/Server/Hostbase/settings.py @@ -95,10 +95,10 @@ ROOT_URLCONF = 'Hostbase.urls' TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates". # Always use forward slashes, even on Windows. - '/usr/lib/python2.3/site-packages/Hostbase/hostbase/webtemplates', - '/usr/lib/python2.4/site-packages/Hostbase/hostbase/webtemplates', - '/usr/lib/python2.3/site-packages/Hostbase/templates', - '/usr/lib/python2.4/site-packages/Hostbase/templates', + '/usr/lib/python2.3/site-packages/Bcfg2/Server/Hostbase/hostbase/webtemplates', + '/usr/lib/python2.4/site-packages/Bcfg2/Server/Hostbase/hostbase/webtemplates', + '/usr/lib/python2.3/site-packages/Bcfg2/Server/Hostbase/templates', + '/usr/lib/python2.4/site-packages/Bcfg2/Server/Hostbase/templates', ) @@ -108,7 +108,7 @@ INSTALLED_APPS = ( 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', - 'Hostbase.hostbase', + 'Bcfg2.Server.Hostbase.hostbase', ) diff --git a/src/lib/Server/Hostbase/urls.py b/src/lib/Server/Hostbase/urls.py index e4ed42996..fe76ae7b2 100644 --- a/src/lib/Server/Hostbase/urls.py +++ b/src/lib/Server/Hostbase/urls.py @@ -1,7 +1,7 @@ import os from django.conf.urls.defaults import * -urlpatterns = patterns('Hostbase.hostbase.views', +urlpatterns = patterns('Bcfg2.Server.Hostbase.hostbase.views', (r'^admin/', include('django.contrib.admin.urls')), (r'^hostbase/$', 'search'), @@ -22,16 +22,6 @@ urlpatterns = patterns('Hostbase.hostbase.views', (r'^hostbase/zones/(?P<zone_id>\d+)/(?P<item>\D+)/(?P<item_id>\d+)/confirm', 'confirm'), ) -#fixme: this is a temp. kludge to handle static serving of css, img, js etc... -#a better solution is to use mod_python/apache directives for the static serving -os.environ['bcfg_media_root'] = '/usr/lib/python2.4/site-packages/Hostbase/media' - -urlpatterns += patterns('', - (r'^site_media/(.*)$', - 'django.views.static.serve', - {'document_root': os.environ['bcfg_media_root'], - 'show_indexes': True}), - ) urlpatterns += patterns('', (r'^login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html'}), |