This volunteer project is a collaboration with my local Makerspace to set up an RFID lock system for doors in the building that houses the Makerspace. My role included creating a Django web interface for staff users to manage lock users and locked spaces, which involves, for example, assigning/un-assigning RFID keycards; managing lock users’ permissions for access to various spaces; viewing logs and stats about visitors. Apart from the interface, I worked with other volunteers on communication with the RFID lock system hardware to authenticate scanned cards.
Python/Django/SQLite (development version)
Responsively styled with Bootstrap.
The code is at https://github.com/gnarlinsky/rfid-lock-admin.
Clone the repository.
$ git clone git@github.com:gnarlinsky/rfid-lock-admin.git
To avoid dependency issues, create a virtualenv and install the required packages.
$ cd rfid-lock-admin
$ virtualenv ve --no-site-packages
$ source ve/bin/activate # activate the virtual environment
$ pip install -r requirements.txt
Create the database and load the initial data.
$ python manage.py syncdb
$ python manage.py loaddata rfid_lock_management/fixtures/initial.json
Run the Django development server.
$ python manage.py runserver
Go to http://localhost:8000/lockadmin to see the application in action. (You can log in as user “moe” and password “moe”)
The script cover.sh (in the top-level directory, on the same level as manage.py) runs both the unit and functional tests (see rfid_lock_management.tests) and determines test coverage, with detailed HTML results.
$ ./cover.sh
Creating test database for alias 'default'...
.........................................................
----------------------------------------------------------------------
Ran 57 tests in 84.264s
OK
Destroying test database for alias 'default'...
Name Stmts Miss Cover Missing
--------------------------------------------------------------------------------
proj_rfid_lock_management/__init__ 0 0 100%
proj_rfid_lock_management/settings 31 0 100%
proj_rfid_lock_management/urls 10 0 100%
rfid_lock_management/__init__ 0 0 100%
rfid_lock_management/admin 137 7 95% 79-92
rfid_lock_management/misc_helpers 9 7 22% 9-18
rfid_lock_management/models 186 0 100%
rfid_lock_management/templatetags/__init__ 0 0 100%
rfid_lock_management/templatetags/custom_filters 35 0 100%
rfid_lock_management/views 98 0 100%
--------------------------------------------------------------------------------
TOTAL 506 14 97%
----------------------------------------------------------------------
HTML results are in htmlcov/index.html
Note
Cover.sh - The line open htmlcov/index.html opens the HTML coverage information with your system’s default browser. Note this may only work in OS X, where the open command opens directories and files with the default application for the file’s extension — so you might want to comment out that statement.
Documentation created with Sphinx, a Python document generator.