Signed-off-by: Arija A. <ari@ari.lt>
This commit is contained in:
2025-10-23 20:36:41 +03:00
parent f6a80c9c4f
commit caf4ac7c06
107 changed files with 3327 additions and 2147 deletions

108
README.md
View File

@@ -1,21 +1,97 @@
## purplebored.pl
# Flask template
Welcome to my personal website, located at https://purplebored.pl ! <br>
This is a simple and goofy website that serves as my personal space on the internet. (Such fancy wording ik)
> Simple flask template
### License Information
Licensed under the [Apache License, Version 2.0](LICENSE)
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
## Running
http://www.apache.org/licenses/LICENSE-2.0
First compile WASM PoW:
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. For the full licene chcek out the LICENSE file
(So much yap abt a license ong)
```sh
cd src/static/js/wasm
./compile.sh
cd ../../../../
```
### Contributing
If you want to conrtibute something to my site just creating a issue first would be ideal!
Then:
```sh
python3 -m venv venv
source venv/bin/activate
source .env # see example.env
pip install --upgrade -r requirements.txt
cd src
memcached -d
# If you remove migrations/:
# flask db init
# vim migrations/script.py.mako (add import flask_app)
# flask db migrate -m 'Initial migration'
flask db upgrade
flask run
```
For production use a WSGI server such as [Gunicorn](https://pypi.org/project/gunicorn/):
```sh
python3 -m venv venv
source venv/bin/activate
source .env # see example.env
pip install --upgrade -r requirements.txt
pip install --upgrade gunicorn
cd src
memcached -d
flask db upgrade
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/>