A very simple Python web application that offers a web interface for searching a system's filesystem by name using locate / mlocate.
- Python3 (developed using 3.5.2)
- Flask (developed using 0.11 installed in a venv with pip)
- A linux distribution with locate/mlocate set up (developed on Ubuntu 16.04)
- Clone to local filesystem
- cd to directory
python3 app.py- For detailed instructions, with autostart and using gunicorn to serve the webapp, see below screenshot
git clone https://github.com/ehoppmann/mlocate-web.gitcd mlocate-websudo apt-get install python3-pippip3 install virtualenvvirtualenv venvsource venv/bin/activatepip3 install -r requirements.txtpip3 install gunicorn- Create the file
/etc/systemd/system/gunicorn.servicewith this content:
[Unit]
Description=gunicorn daemon
After=network.target
[Service]
PIDFile=/run/gunicorn/pid
User=<USER YOU WANT THIS TO RUN AS - SUGGEST LIMITED USER>
Group=<GROUP YOU WANT THIS TO RUN AS>
WorkingDirectory=<BASE DIRECTORY - WHERE YOU CLONED TO>
ExecStart=<BASE DIRECTORY - WHERE YOU CLONED TO>/venv/bin/gunicorn --workers 3 -b 0.0.0.0:8000 app:app
[Install]
WantedBy=multi-user.target
systemctl start gunicornsystemctl enable gunicorn
The search service should now be available on port 8000 and will automatically start with the system.
