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 ## Usage
1. Create a repository from this template 1. Create a repository from this template
2. For debugging, change the database connection parameters 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 of MariaDB/MySQL server on your PC
1. If you have no MariaDB/MySQL test server installed, 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)", 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 - `db_url` is the MySQL connection URL
generated from the sql_settings configuration; generated from the sql_settings configuration;
just edit the line declaring `db_url` in `db.py` 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 ### Paths
`app/paths` directory contains all FastAPI paths `app/paths` directory contains all FastAPI paths
@ -106,7 +106,7 @@ You can
> In the paths files, FastAPI's decorators > In the paths files, FastAPI's decorators
are called with `@self.app.`, not just `@app.` 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: `app/main.py` also must be modified:
1. Find the comment `# Add your own paths...` 1. Find the comment `# Add your own paths...`
2. Add or remove import statements below 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, > The first one is needed for SELECT requests,
and the second one is for INSERT requests (creating users). and the second one is for INSERT requests (creating users).
> The first one contains all information about user, > 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, because we don't want to specify an ID when creating a new user,
it will be generated automatically by the MariaDB server. 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 To leave the same HTTP method, use 307 status code
or call `with_redirect_307` function. or call `with_redirect_307` function.
`args` and `kwargs` are passed directly `args` and `kwargs` are passed directly
to the Response contructor. to the Response constructor.
**Args:** **Args:**
- url (str, optional): Target URL, root by default - url (str, optional): Target URL, root by default
@ -198,7 +198,7 @@ As said before,
#### `with_text(content, code=200, ...)` #### `with_text(content, code=200, ...)`
Return a plain text to the user. Return a plain text to the user.
`args` and `kwargs` are passed directly `args` and `kwargs` are passed directly
to the Response contructor. to the Response constructor.
**Args:** **Args:**
- content (str): Plain text content - content (str): Plain text content
@ -242,7 +242,7 @@ the correct type hint (`: Request`)
Send the file specified in `path` Send the file specified in `path`
automatically guessing its mimetype if `mime` is None. automatically guessing its mimetype if `mime` is None.
`args` and `kwargs` are passed directly `args` and `kwargs` are passed directly
to the Response contructor. to the Response constructor.
**Args:** **Args:**
- path (os.PathLike): File path - path (os.PathLike): File path

View file

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

View file

@ -1,9 +1,16 @@
fastapi==0.92.0 fastapi~=0.92.0
uvicorn[standard]==0.20.0 starlette~=0.25.0
gunicorn==20.1.0 pydantic~=1.10.5
jinja2==3.1.2
starlette-wtf==0.4.3 uvicorn[standard]~=0.20.0
sqlalchemy==2.0.4 gunicorn~=20.1.0
sqlalchemy-utils==0.40.0
mysqlclient==2.1.1 jinja2~=3.1.2
python-dotenv==0.21.1 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,11 +5,11 @@
{% block content %} {% block content %}
<h1>500: ISE</h1> <h1>500: ISE</h1>
<p> <p>
An error occured while An error occurred while
processing your request. processing your request.
</p> </p>
<p> <p>
Please, try again later Please, try again later
or contact web site admin. or contact website admin.
</p> </p>
{% endblock %} {% endblock %}