From 99dcd1f800775ee70e3484c6d65d6d86518b04b1 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sun, 30 Sep 2018 00:56:19 -0700 Subject: [PATCH] Put setup & run steps into
spoilers. Improve clarity. --- README.md | 52 +++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 6c67d2f..c914e26 100644 --- a/README.md +++ b/README.md @@ -7,19 +7,15 @@ I am currently running a demonstration copy of Etiquette at http://etiquette.vou Etiquette is a tag-based file organization system with a web front-end. -#### Setting up +### Setting up -I have not made a setup.py yet. So you must make the `etiquette` package importable in one of two ways: +I have not made a setup.py yet. So I use a filesystem junction / symlink to make etiquette appear in my python lib folder. -- By editing your `PYTHONPATH` environment variable. Note that the path refers to the Etiquette repository location and not the `etiquette` package folder: +
Setting up via symlink - Windows: `set "PYTHONPATH=%PYTHONPATH%;D:\Git\Etiquette"` Note the semicolon to delimit paths. To make permanent, use the Environment Variable editor or the `setx` command. The editor is better. - - Linux: `PYTHONPATH="$PYTHONPATH:/home/Owner/Git/Etiquette"` Note the colon to delimit paths. To make permanent, add the export to your bashrc. - -- By placing it in one of your lib paths, or using filesystem junctions to make it appear in a lib path. Note that this time, the path does refer to the package itself. - - The easiest way to find your lib path is `python -c "import os; print(os)"`. +- The repository you're looking at right now is `D:\Git\Etiquette`. The toplevel `etiquette` folder is the main package. We want this package to be a child of our existing lib directory. +- The easiest way to find your lib path is `python -c "import os; print(os)"`. +- Make the symlink: Windows: `mklink /J fakepath realpath` for example `mklink /J "C:\Python36\Lib\etiquette" "D:\Git\Etiquette\etiquette"` @@ -27,18 +23,42 @@ I have not made a setup.py yet. So you must make the `etiquette` package importa Linux: `ln --symbolic realpath fakepath` for example `ln --symbolic "/home/Owner/Git/Etiquette/etiquette" "/usr/local/lib/python3.6/etiquette"` -I'm sure you'll figure it out. +
-#### Running locally +--- + +
Setting up via pythonpath + +- The repository you're looking at right now is `D:\Git\Etiquette`. The toplevel `etiquette` folder is the main package. We want the repository to be treated as an alternative lib directory, because the package is a child of it. + + Windows: `set "PYTHONPATH=%PYTHONPATH%;D:\Git\Etiquette"` + Note the semicolon to delimit paths. + This only applies to the current cmd session. To make it permanent, use Windows's Environment Variable editor or the `setx` command. The editor is easier to use. + + Linux: `PYTHONPATH="$PYTHONPATH:/home/Owner/Git/Etiquette"` + Note the colon to delimit paths. + To make it permanent, add the export to your bashrc. + +
+ +--- + +
Running locally - Run `python etiquette_flask_launch.py [port]` to launch the flask server. Port defaults to 5000 if not provided. - Run `python -i etiquette_repl_launch.py` to launch the Python interpreter with the PhotoDB pre-loaded into a variable called `P`. Try things like `P.new_photo` or `P.digest_directory`. - Note: Do not `cd` into the frontends folder. Stay wherever you want the photodb to be created, and start the frontend by specifying full file path of the launch file. - D:\somewhere>python D:\Git\Etiquette\frontends\etiquette_flask\etiquette_flask_launch.py 5001 - /home/Owner>python /home/Owner/Git/Etiquette/frontends/etiquette_flask/etiquette_flask_launch.py 5001 + Windows: + D:\somewhere> python D:\Git\Etiquette\frontends\etiquette_flask\etiquette_flask_launch.py 5001 -#### Running with Gunicorn + Linux: + /somewhere $ python /home/Owner/Git/Etiquette/frontends/etiquette_flask/etiquette_flask_launch.py 5001 +
+ +--- + +
Running with Gunicorn 1. Use the PYTHONPATH technique to make `etiquette` and `etiquette_flask` both importable. Symlinking into the lib is not as convenient here because the server relies on the static files and jinja templates relative to the code's location. @@ -48,6 +68,8 @@ I'm sure you'll figure it out. gunicorn etiquette_flask_entrypoint:site --bind "0.0.0.0:PORT" --access-logfile "-" +
+ ### Project stability You may notice that Etiquette doesn't have a version number anywhere. That's because I don't think it's ready for one. I am using this project to learn and practice, and breaking changes are very common.