From 50dac05d76e36020536ac7c75325f54d1caba3dd Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Thu, 26 Jan 2017 01:02:41 +0100
Subject: [PATCH] Add start / virtualenv helpers.

---
 requirements.txt |  2 ++
 run.sh           | 17 +++++++++++++++++
 url_catcher.py   |  2 ++
 3 files changed, 21 insertions(+)
 create mode 100644 requirements.txt
 create mode 100755 run.sh
 mode change 100644 => 100755 url_catcher.py

diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..114dbd4
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,2 @@
+bottle==0.12.13
+validators==0.11.2
diff --git a/run.sh b/run.sh
new file mode 100755
index 0000000..5fe6132
--- /dev/null
+++ b/run.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+# This script runs the url-catcher in a virtual environment with temporarily
+# installed required external Python libraries.
+set -e
+
+DIR_ENV=.temp_env
+
+pyvenv $DIR_ENV 
+source $DIR_ENV/bin/activate
+pip install -r requirements.txt
+echo
+set +e
+uwsgi --socket 127.0.0.1:3031 --wsgi-file url_catcher.py 
+set -e
+deactivate
+rm -rf $DIR_ENV 
diff --git a/url_catcher.py b/url_catcher.py
old mode 100644
new mode 100755
index ac4b7a7..ca0974f
--- a/url_catcher.py
+++ b/url_catcher.py
@@ -1,3 +1,5 @@
+#!/usr/bin/python3
+
 import bottle
 import validators
 import html
-- 
2.30.2