Skip to content

Commit 15af143

Browse files
committed
Removed unused import
1 parent 5247fae commit 15af143

File tree

1 file changed

+47
-12
lines changed

1 file changed

+47
-12
lines changed

README.md

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,56 @@ Features:
1717

1818
## How to run this
1919

20-
Start with `mrmat-python-api-flask`. You can specify `--host 0.0.0.0` to listen on a specific API and `--port PORT` to
21-
override the default 8080.
20+
You have the choice of running this directly or within a container image. To run this directly:
2221

23-
Once started, you can do curl towards the greeting API at `/api/greeting/v1/` and `/api/greeting/v1/?name=Custom`.
24-
Note that omitting the last slash will cause a redirect that you can follow using curls -L option. We can probably
25-
get rid of that by using a more clever versioning scheme that doesn't make the root resource listen on / (e.g. `/greeting`).
22+
```
23+
$ python ./setup.py install
24+
$ mrmat-python-api-flask -h
25+
usage: mrmat-python-api-flask [-h] [-d] [--host HOST] [--port PORT]
2626
27-
## How to test this
27+
mrmat-python-api-flask - 0.0.1
28+
29+
optional arguments:
30+
-h, --help show this help message and exit
31+
-d, --debug Debug
32+
--host HOST Host interface to bind to
33+
--port PORT Port to bind to
34+
35+
$ mrmat-python-api-flask --host 0.0.0.0 --port 8080
36+
* Serving Flask app "mrmat_python_api_flask.app" (lazy loading)
37+
* Environment: production
38+
WARNING: This is a development server. Do not use it in a production deployment.
39+
Use a production WSGI server instead.
40+
* Debug mode: off
41+
* Running on http://0.0.0.0:8080/ (Press CTRL+C to quit)
42+
43+
<Ctrl-C>
44+
```
45+
46+
To run within a container, first build that container:
2847

29-
Pycharm built-in. If you do it on the CLI, you do need `python -m pytest`, otherwise it'll get confused about loading
30-
its modules. Also note that the API spec yaml must be added once more when testing in `conftest.py`. The obvious attempt
31-
to have that done straight within `mrmat_python_api_flask/app.py` outside main doesn't work (and I don't know why).
48+
```
49+
$ python ./setup.py sdist
50+
$ docker build -t mrmat-python-api-flask:0.0.1 -f var/docker/Dockerfile .
51+
...
52+
$ docker run --rm mrmat-python-api-flask:0.0.1
53+
...
54+
```
3255

33-
## How to build this
56+
## How to use this
57+
58+
Once started, you can curl towards the APIs mounted at various places. See the invocation of `app.register_blueprint`
59+
within `app/app.py` to find out where.
60+
61+
>Note that omitting the last slash will cause a redirect that you can follow using curls -L option. We can probably
62+
>get rid of that by using a more clever versioning scheme that doesn't make the root resource listen on / (e.g. `/greeting`).
63+
64+
## How to test this
3465

35-
See the provided Dockerfile in `var/docker`. This requires that you have run `python ./setup.py sdist` as a prerequisite
36-
and will create a container image in which the application is run within a production-ready WSGI server.
66+
Unit tests are within the `tests` directory. You can use the built-in Pycharm test configuration or do it on the CLI.
3767

68+
```
69+
$ python ./setup.py install
70+
$ python -m flake8
71+
$ python -m pytest
72+
```

0 commit comments

Comments
 (0)