Services/django

From popdata
Jump to: navigation, search

Back to Systems/Services

Django on Cartier: pds.popdata.bc.ca my.popdata.bc.ca /home/www/pds/

  • Django admin: https://pds.popdata.bc.ca/admin/
  • "available" page: names and status of machines : https://pds.popdata.bc.ca/admin/portal/sremachine/
    NB "State" field updated automatically every minute.
  • Version 1.3.1 (python; import django; django.VERSION)
  • /usr/lib/python2.5/site-packages/django/core/handlers/modpython.py
  • Apache settings in /etc/apache2/sites-enabled/portal (ex: "PythonDebug on").
    • pointing to Django Settings in /home/www/pds/portal-settings.py (ex: DEBUG = True)
PDS workaround 2014-08-20 for project creation

An example of how to use command-line on Sullivan to manually modify Django database entries

dlaplante@sullivan:/home/www/pds%   ./manage.py shell_plus
project_tmp = PopGroup.objects.get(name="13-031")
print project_tmp, project_tmp.group_type
13-031 (214) 
>>> project_tmp.group_type = "project"
>>> print project_tmp, project_tmp.group_type
13-031 (214) project
>>> project_tmp.save()
PDS manual deletion of user
  • Deleting a PDS user when LDAP gets error
    • Normal usage: https://pds.popdata.bc.ca/users/delete/{NUMERIC_ID}
      • code: pds/users/views.py:275: def delete(request, Id=):
        gets subusers from PDS : popdata = user.popdata; subusers = PopData.objects.filter(parent=user)
        to provide preview
      • if "Yes" delete_user(user)
      • code: general/ldaputil.py:57 def delete_user(user, children = False):
        remove from LDAP groups and AD groups; remove user from LDAP and AD; recursively process children
      • now the scary part: delete user from PDS database
        user.delete()

For example:

So once the LDAP entries have been removed for "enethery" (ID=5091) and subusers have been deleted
% cd /home/www/pds && ./manage.py shell_plus
>>> user = User.objects.get(id=5091)
>>> print user
Elizabeth Nethery (enethery)
>>> subusers = PopData.objects.filter(parent=user)
>>> print subusers
[]
user.delete()