There are 2 apis for Face Enrollment & Face Recognition:
- Face Enrollment api endpoint: /api/v1/face_enrollment
- Face Recognition api endpoint: /api/v1/face_detect
-
Clone the git repo:
-
Create venv for the project & activate the environment:
"virtualenv /opt/env" or "python3 -m venv env" source /opt/env/bin/activate
-
Install all the dependencies:
pip3 install -r requirements.txt
-
Before starting the Django development server, you can check your Django project for potential problems:
cd face_recognition/ python manage.py check
-
Make Gunicorn configuration:
mkdir -pv config/gunicorn/
"""Gunicorn *development* config file""" # Django WSGI application path in pattern MODULE_NAME:VARIABLE_NAME wsgi_app = "face_detect.wsgi:application" # The granularity of Error log outputs loglevel = "debug" # The number of worker processes for handling requests workers = 2 # The socket to bind bind = "0.0.0.0:8000" # Restart workers when code changes (development only!) reload = True # Write access and error info to /var/log accesslog = errorlog = "/var/log/gunicorn/dev.log" # Redirect stdout/stderr to log file capture_output = True # PID file so you can easily fetch process ID pidfile = "/var/run/gunicorn/dev.pid" # Daemonize the Gunicorn process (detach & enter background) daemon = True
Next, make sure that log and PID directories exist for the values set in the Gunicorn configuration file above:
>> sudo mkdir -pv /var/{log,run}/gunicorn/
With that out of the way, you can start Gunicorn using the -c flag to point to a configuration file from your project root:
>> gunicorn -c config/gunicorn/dev.py
>> tail -f /var/log/gunicorn/dev.log