From 8b61a6bf8d4fb3a8a4df0742b214d2461eaa4876 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Mon, 6 Mar 2023 17:34:13 +0400 Subject: [PATCH] Updated and grouped deps, fixed typos in readme and docstrings --- README.md | 14 +++++++------- app/respond.py | 6 +++--- requirements.txt | 25 ++++++++++++++++--------- templates/500.html | 4 ++-- 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index db042b9..9055a60 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/app/respond.py b/app/respond.py index 816e574..33148b0 100644 --- a/app/respond.py +++ b/app/respond.py @@ -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 diff --git a/requirements.txt b/requirements.txt index a8174e0..a3d4155 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/templates/500.html b/templates/500.html index 2835a07..fd719a7 100644 --- a/templates/500.html +++ b/templates/500.html @@ -5,11 +5,11 @@ {% block content %}

500: ISE

- An error occured while + An error occurred while processing your request.

Please, try again later - or contact web site admin. + or contact website admin.

{% endblock %}