This is a self-educational project created only for sake of trying to build a simple CRUD project using the Flask framework.
It consists of the two parts:
Server runs a RESTful API and SSR web-app.
Client, in turn, provides a simple terminal-based access to the RESTful API provided by the server.
- Python 3.12;
- Flask 3.0.x (for server);
- Requests 2.x.x (for client).
Exact versions used in development are specified in the requirements.txt.
To run server or client you must firstly set your working directory to the src. When you are ready, proceed to the following sections.
To run server with the default options simply execute the following command in your terminal:
python3 -m server
You can additionaly pass a one or more arguments to the server. The following table contains a list of available options with their default values and description.
Option | Allowed Arguments | Default Value | Description |
---|---|---|---|
-h , --help |
- | - | show help |
--web-url-prefix |
str |
"/" |
URL prefix of the web-app |
--api-url-prefix |
str |
"/api" |
URL prefix of the REST API |
--secret-filename |
str |
"secret.key" |
filename of the secret key |
--secret-len |
int in range [1, 2^16) |
64 |
length of the secret key |
-p , --port |
int in ragne [0, 2^16) |
8000 |
port number |
-s , --storage-type |
"picle" or "sqlite3" |
"picle" |
type of the storage to be used |
--pickle-storage-dirname |
str |
"db.pickle" |
name of the directory pickle storage uses to store database |
--sqlite3-storage-filename |
str |
"db.sqlite3" |
filename of the Sqlite3 database |
-d , --debug |
- | - | enables debug mode |
To run client with the default options simply execute the following command in your terminal:
python3 -m client
You can additionaly pass a one or more arguments to the client. The following table contains a list of available options with their default values and description.
Option | Allowed Arguments | Default Value | Description |
---|---|---|---|
-h , --help |
- | - | show help |
-a , --address |
str |
"http://localhost:8000/api" |
server's REST API address |