Updated and grouped deps, fixed typos in readme and docstrings

This commit is contained in:
DarkCat09 2023-03-06 17:34:13 +04:00
parent 73886fbc0e
commit 8b61a6bf8d
4 changed files with 28 additions and 21 deletions

View file

@ -17,7 +17,7 @@ Includes Jinja, WTForms, MySQL ORM and Docker.
## Usage
1. Create a repository from this template
2. For debugging, change the database connection parameters
in `.env_debug` file correspoding to the configuration
in `.env_debug` file corresponding to the configuration
of MariaDB/MySQL server on your PC
1. If you have no MariaDB/MySQL test server installed,
search for "[mariadb install (your linux distro)](https://searx.dc09.ru/search?q=mariadb+install+ubuntu)",
@ -85,7 +85,7 @@ Make commands:
- `db_url` is the MySQL connection URL
generated from the sql_settings configuration;
just edit the line declaring `db_url` in `db.py`
if you are going to use other DBMS, e.g. PostgreSQL
if you are going to use other DBMS, e.g. PostgresSQL
### Paths
`app/paths` directory contains all FastAPI paths
@ -106,7 +106,7 @@ You can
> In the paths files, FastAPI's decorators
are called with `@self.app.`, not just `@app.`
In case of deleteing/renaming/creating any paths files,
In case of deleting/renaming/creating any paths files,
`app/main.py` also must be modified:
1. Find the comment `# Add your own paths...`
2. Add or remove import statements below
@ -161,7 +161,7 @@ there are two schemas — `User` and `UserCreate` — for one `User` SQLAlchemy
> The first one is needed for SELECT requests,
and the second one is for INSERT requests (creating users).
> The first one contains all information about user,
but the second one (`UserCreate`) ommits `id` field,
but the second one (`UserCreate`) omits `id` field,
because we don't want to specify an ID when creating a new user,
it will be generated automatically by the MariaDB server.
@ -177,7 +177,7 @@ By default, code is 302 so method is changed to GET.
To leave the same HTTP method, use 307 status code
or call `with_redirect_307` function.
`args` and `kwargs` are passed directly
to the Response contructor.
to the Response constructor.
**Args:**
- url (str, optional): Target URL, root by default
@ -198,7 +198,7 @@ As said before,
#### `with_text(content, code=200, ...)`
Return a plain text to the user.
`args` and `kwargs` are passed directly
to the Response contructor.
to the Response constructor.
**Args:**
- content (str): Plain text content
@ -242,7 +242,7 @@ the correct type hint (`: Request`)
Send the file specified in `path`
automatically guessing its mimetype if `mime` is None.
`args` and `kwargs` are passed directly
to the Response contructor.
to the Response constructor.
**Args:**
- path (os.PathLike): File path

View file

@ -22,7 +22,7 @@ def with_redirect(
To leave the same HTTP method, use 307 status code
or call `with_redirect_307` function.
`kwargs` are passed directly
to the Response contructor
to the Response constructor
Args:
url (str, optional): Target URL, root by default
@ -45,7 +45,7 @@ def with_text(
**kwargs) -> PlainTextResponse:
"""Return a plain text to the user.
`kwargs` are passed directly
to the Response contructor
to the Response constructor
Args:
content (str): Plain text content
@ -121,7 +121,7 @@ def with_file(
"""Send the file specified in `path`
automatically guessing its mimetype if `mime` is None.
`kwargs` are passed directly
to the Response contructor
to the Response constructor
Args:
path (os.PathLike): File path

View file

@ -1,9 +1,16 @@
fastapi==0.92.0
uvicorn[standard]==0.20.0
gunicorn==20.1.0
jinja2==3.1.2
starlette-wtf==0.4.3
sqlalchemy==2.0.4
sqlalchemy-utils==0.40.0
mysqlclient==2.1.1
python-dotenv==0.21.1
fastapi~=0.92.0
starlette~=0.25.0
pydantic~=1.10.5
uvicorn[standard]~=0.20.0
gunicorn~=20.1.0
jinja2~=3.1.2
starlette-wtf~=0.4.3
wtforms~=3.0.1
sqlalchemy~=2.0.5.post1
sqlalchemy-utils~=0.40.0
mysqlclient~=2.1.1
python-dotenv~=1.0.0

View file

@ -5,7 +5,7 @@
{% block content %}
<h1>500: ISE</h1>
<p>
An error occured while
An error occurred while
processing your request.
</p>
<p>