Readme: Usage section

This commit is contained in:
DarkCat09 2023-02-27 18:17:28 +04:00
parent 3c6da6a49a
commit 9af92175a9

View file

@ -14,6 +14,38 @@ Includes Jinja, WTForms, MySQL ORM and Docker.
- Dockerfile, Docker-Compose
## Usage
1. Create a repository from this template
2. For debugging, change the database connection parameters
in `.env_debug` file correspoding to the configuration
of MariaDB/MySQL server on your PC
3. Edit app [paths](#paths),
[custom error pages](#custom-error-pages)
and [forms](#wtforms)
as explained in the "Structure" section
4. Create your own Jinja templates in the `templates/` directory,
editing `base.html` and inheriting other templates from it is recommended
(see `index,table,admin.html` for examples)
5. Edit or remove CSS and JS files in `static/`
6. Edit `sql/models,schemas,crud.py`
corresponding to your database structure
as explained below ([Structure > Database](#database))
7. Check if `Makefile`, `Dockerfile`, `docker-compose.yml` are correct
8. Run the formatter and linters (`make format`, then `make check`)
9. Build a docker image and [publish](#publishing-app) it
### Makefile
Make commands:
|Command|Description|
|:-----:|:----------|
|`make format`|Format the code using AutoPEP8|
|`make check`|Check the code with linters (MyPy, Pylint)|
|`make dev`|Run the app in development mode|
|`make prod`|Run a production server|
|`make docker`|Build a docker image from `Dockerfile`|
|`make clean`|Clean all cache|
## Structure
### Configuration
@ -66,7 +98,7 @@ You can
copying the contents of `pages.py`
> **Note**
> In the paths files FastAPI's decorators
> In the paths files, FastAPI's decorators
are called with `@self.app.`, not just `@app.`
In case of deleteing/renaming/creating any paths files,
@ -92,36 +124,6 @@ TODO
TODO
## Usage
<!--
1. Create a repository from this template
2. For debugging, open `.env_debug` file and
set host, user, password corresponding to
the configuration of MySQL/MariaDB on your PC
3. Edit `paths/pages.py`: add your own paths
in the `add_paths` method
4. Create your own Jinja templates in `templates/` directory,
I recommend to edit `base.html` and inherit other templates from it
5. Edit and rename `forms/users.py`, it contains WTForms classes
6. Customize error pages and add your own paths ...
7. Edit `db/schema.sql` corresponding to your database structure
8. Check `Makefile`, `Dockerfile`, `docker-compose.yml`
9. Run formatter and linters (`make format`, then `make check`)
-->
### Makefile
Make commands:
|Command|Description|
|:-----:|:----------|
|`make format`|Format the code using AutoPEP8|
|`make check`|Check the code with linters (MyPy, Pylint)|
|`make dev`|Run the app in development mode|
|`make prod`|Run a production server|
|`make docker`|Build a docker image from `Dockerfile`|
|`make clean`|Clean all cache|
## Helper functions
### `respond.py`