206CDE - Real World Project - 1718JANMAY - Group 8B
Coventry University Attendance System (cuas) is an alternative attendance management system. Students often forget their student cards, meaning they can't sign in to university lectures. Our proposed system provides an alternative/additional method of signing in using the students' phone cameras for reading QR codes, via the Tracker app. A webapp can also be used by lecturers for monitoring attendance.
Install Python 2.7 if you haven't already got it. The Python executable must be available in your PATH environment variable; if you can't already run python
from Command Prompt, you might need to add it yourself. Check this works but opening a Command Prompt (right click start, hit 'Command Prompt') and enter 'python
'. Ctrl+C closes Python.
On Linux, in this case Ubuntu, sudo apt-get install python python-dev python-pip
should get everything you need. Test in a shell by running python
, with Ctrl+D to exit. See how much easier that was? yeah Windows sucks.
You also need Python's virtualenv
package. Install (in an admin Command Prompt, or using sudo on Linux) using:
python -m pip install virtualenv
You've got Python set up and you can run it from a command line? It's all rainbows and blue skies from here. This bit assumes you're already in the directory you've cloned the repo to. On my Windows PC, it's this: C:\Users\James\gitr\cu-attendance-system
.
First, hop into the server directory:
cd server
Then set up a Python virtual environment:
python -m virtualenv venv
Activate the virtualenv. This just tells the current cmd/shell session to use the virtual environment instead of the global Python packages. On Windows:
venv\Scripts\activate.bat
or on Linux/Mac:
source venv/bin/activate
Now you're in the venv, install all the packages the server program needs. I made this easier by supplying a magic requirements file:
python -m pip install -r requirements.txt
Everything is ready! Now all you have to do is run the server file: Running this file directly puts in in debug mode.
python server.py
To test, open to a browser and go to http://localhost:5000/api/hello. If you've got a friendly message saying "hello", the server is working! Go to http://localhost:5000 to see the site running.
As you make changes to server.py
or any of the module files, it should automatically restart, applying the changes. Updating stuff on the site often requires a Ctrl+F5 (hard refresh) in the browser.
Messed up the database? You fool. Fortunately I do this too tbh and made a script to reset it.
From the server
directory, run this:
python database/database_create.py
This just drops all the tables and recreates them and adds a bit of example data.
To run the Android app, install Android Studio. Start Android Studio, and open the cu-attendance-system/app
project. As the project loads, it prompts you to install all the necassary components.
Build the project, and then run on an emulator or a physical Android device via adb. To run on a physical device, you must first enable USB debugging in the device's settings.