This API is meant to supoort the Android application present in this repository by centralizing its users data.
The database is MySQL based, MariaDB, and may be installed under Linux OS as show below.
-
Yum/Dnf Based
dnf install mariadb mariadb-server
-
Debian Based
apt-get install mariadb mariadb-server
You may need to grant access to a specific user and create a database if you do not change the configuration file.
The commands below should help you accomplish the access restrictions mentioned before.
GRANT ALL PRIVILEGES ON inventory_app.* to 'inventory_user'@'localhost' IDENTIFIED BY 'inventory_pass' WITH GRANT OPTION;
FLUSH PRIVILEGES;
CREATE DATABASE inventory_app;
The API is fairly easy to deploy, just change into the projects api/ directory and install all the requirements in the requirements.txt file with the follwoing command:
pip install -r requirements.txt
The API is executed with the following command:
python3 run.py
The database is MySQL based, MariaDB, and may be installed under Linux OS as show below.
-
Download MariaDB installer from their website
-
Execute the installer as administrator and accept the HeidiSQL installation as it will help you with manual database operations.
-
Proceed along the setup and set a password for the 'root' user which you will remember.
-
You may need to grant access to a specific user and create a database if you do not change the configuration file.
The commands below should help you accomplish the access restrictions mentioned before. You can ue HeidiSQL client to execute the following commands after connecting to the MariaDB instance with the 'root' user and the password you previously set.
GRANT ALL PRIVILEGES ON inventory_app.* to 'inventory_user'@'localhost' IDENTIFIED BY 'inventory_pass' WITH GRANT OPTION;
FLUSH PRIVILEGES;
CREATE DATABASE inventory_app;
For the API you'll need to install Python 3.6:
-
Download Python 3.6 from the following URL:
-
Execute the installer as Administrator and check the option 'Add python to PATH variable'
-
Finish the installation.
-
Download the following version of mysqlclient pip package from https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient and choose the option which fits your computer's architecture:
- 32-bit: mysqlclient‑1.3.13‑cp36‑cp36m‑win32.whl
- 64-bit: mysqlclient‑1.3.13‑cp36‑cp36m‑win_amd64.whl
Proceed to install the package with PIP:
pip install mysqlclient‑1.3.13‑cp36‑cp36m‑win_amd64.whl
The API is fairly easy to deploy, open up CMD and change into the projects api/ directory and install all the requirements in the requirements.txt file with the following command:
pip install -r requirements_win.txt
A default configuration file is placed in the config directory, you must copy it into a 'config.py' in the same directory and overried the default values if you wish to:
cp config/config_example.py config/config.py
After this, execute the API with the following command:
python3 run.py