Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,31 @@
Graphing polyamorous relationships with force directed layouts.

## Development

You will need to install Python, virtualenv, and GraphViz using whatever package manager your operating system uses. Then you can setup, run and test the application as follows:
### Run locally
You will need to install Python, virtualenv, libffi (for building cffi) and GraphViz using whatever package manager your operating system uses. Then you can setup, run and test the application as follows:

1. Create a new virtualenv environment by running `make`
2. Run the application by running `make run` and opening http://localhost:5000/ in a browser
3. Run the tests by running `make test`

Alternatively, you can use Docker:

### Run using Docker
1. Build and run the image by using `docker-compose up --detach`
2. Alternatively, you can use development mode by using `docker-compose -f docker-compose.yml -f docker-compose.dev.yml up`

#### Logging
The Dockerfile (as of writing) uses gunicorn, which doesn' show `print` output. The function below can be used as a replacement
```python
def log(message, path="log.txt"):
with open(path, "a+", encoding="utf-8") as file:
file.write("\n" + message)
```

## Environment variables
| Key | Default value |
| ---------- | --------------- |
| ip | `None` |
| DATABASE | `dev.db` |
| SECRET_KEY | `SET ME PLEASE` |

## License
This project is licensed under the [MIT License](LICENSE).
6 changes: 4 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
version: "3"
services:
polycul.es:
build: .
ports:
- 5000:5000

environment:
- SECRET_KEY=RAND0M_V@LUE
# - ip=127.0.0.1
# - DATABASE=dev.db
9 changes: 7 additions & 2 deletions polycules.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,12 @@ def export_png(polycule_id):
return Response(png, mimetype="image/png")


if __name__ == "__main__":

run_directly = __name__ == "__main__"
run_gunicorn = __name__ == "polycules"

if run_directly or run_gunicorn:
migrate()

app.run(host=IP)
if run_directly:
app.run(host=IP)
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ requests==2.22.0
retrying==1.3.3
six==1.14.0
toml==0.10.1
typed-ast==1.4.1
typed-ast==1.5.5
urllib3==1.25.8
webencodings==0.5.1
Werkzeug==1.0.1