Update repository meta files (README & license)
Signed-off-by: Arija A. <ari@ari.lt>
This commit is contained in:
4
LICENSE
4
LICENSE
@@ -629,8 +629,8 @@ to attach them to the start of each source file to most effectively
|
|||||||
state the exclusion of warranty; and each file should have at least
|
state the exclusion of warranty; and each file should have at least
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
purplebored's website
|
||||||
Copyright (C) <year> <name of author>
|
Copyright (C) 2023-2025 Purplebored
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU Affero General Public License as published by
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
|||||||
57
README.md
57
README.md
@@ -1,6 +1,6 @@
|
|||||||
# Flask template
|
# purplebored.pl
|
||||||
|
|
||||||
> Simple flask template
|
> Just my personal website
|
||||||
|
|
||||||
## Running
|
## Running
|
||||||
|
|
||||||
@@ -42,56 +42,3 @@ memcached -d
|
|||||||
flask db upgrade
|
flask db upgrade
|
||||||
python3 -m gunicorn -b 127.0.0.1:12345 -w 4 app:app # ... Or whatever your configuration is
|
python3 -m gunicorn -b 127.0.0.1:12345 -w 4 app:app # ... Or whatever your configuration is
|
||||||
```
|
```
|
||||||
|
|
||||||
## I don't want a generic `flask_app` module name
|
|
||||||
|
|
||||||
Run `python3 rename.py <new_module_name>`, for example, `python3 rename.py my_app` :)
|
|
||||||
|
|
||||||
## I need custom subcommands
|
|
||||||
|
|
||||||
In `src/flask_app/__init__.py` you can register your custom `flask` subcommands using `click`:
|
|
||||||
|
|
||||||
```py
|
|
||||||
import click
|
|
||||||
import flask
|
|
||||||
|
|
||||||
|
|
||||||
@click.command("hello")
|
|
||||||
def cmd_hello() -> None:
|
|
||||||
"""Print hello"""
|
|
||||||
print("Hello!")
|
|
||||||
|
|
||||||
|
|
||||||
def create_app(name: str) -> flask.Flask:
|
|
||||||
...
|
|
||||||
|
|
||||||
app: flask.Flask = flask.Flask(name)
|
|
||||||
|
|
||||||
...
|
|
||||||
|
|
||||||
# Commands
|
|
||||||
|
|
||||||
app.cli.add_command(create_counter)
|
|
||||||
|
|
||||||
...
|
|
||||||
|
|
||||||
return app
|
|
||||||
```
|
|
||||||
|
|
||||||
If you have a lot of custom commands it is advised you move your commands to a file called `commands.py` or alike, then register them as usual using `app.cli.add_command`. To run these subcommands you would simply do
|
|
||||||
|
|
||||||
```sh
|
|
||||||
flask hello
|
|
||||||
```
|
|
||||||
|
|
||||||
Or whatever your custom subcommand is.
|
|
||||||
|
|
||||||
## Linting and Formatting
|
|
||||||
|
|
||||||
Use the following tools:
|
|
||||||
|
|
||||||
- Black: <https://pypi.org/project/black/>
|
|
||||||
- Isort: <https://pypi.org/project/isort/>
|
|
||||||
- Pyright: <https://pypi.org/project/pyright/>
|
|
||||||
- Flake8: <https://pypi.org/project/flake8/>
|
|
||||||
- Mypy: <https://pypi.org/project/mypy/>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user