From 1dab3b1d2f95cf3fa66f20298b5efdaa5bb1dd81 Mon Sep 17 00:00:00 2001 From: MendyLanda Date: Mon, 5 Dec 2022 00:59:55 +0100 Subject: [PATCH] easy start with shell script --- README.md | 26 ++------------------------ run.sh | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 24 deletions(-) create mode 100755 run.sh diff --git a/README.md b/README.md index 9c9e12d..90db597 100644 --- a/README.md +++ b/README.md @@ -8,32 +8,10 @@ * Make sure that python and virual environment is installed. -* Create a new virtual environment - -```python -# one time -virtualenv -p $(which python3) pyenv - -# everytime you want to run the server -source pyenv/bin/activate -``` - -* Now install the requirements - -``` -pip install -r requirements.txt -``` - -* If you are installing playwright for the first time, it will ask you to run this command for one time only. - -``` -playwright install -``` - -* Now run the server +* To start the server run the following command ``` -python server.py +chmod +x run.sh && ./run.sh ``` * The server runs at port `5001`. If you want to change, you can change it in server.py diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..3485607 --- /dev/null +++ b/run.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +# exit on error +set -e + +# create a virtual envoirment if it doesn't exist +if [ ! -d pyenv ]; then + echo "Creating virtual environment" + virtualenv -p $(which python3) pyenv +fi + +echo "Activating virtual environment" +source pyenv/bin/activate + +echo "Installing requirements" +pip install -r requirements.txt + +echo "Installing playwright chromium driver" +playwright install + +echo "Starting server" +python server.py \ No newline at end of file