Using single database to sync two interfaces (Web, CLI).
Environments and module/libraries
- Atleast
Python
3.10 - Atleast
PHP
8.0 - Atleast
NodeJS
16.18 - Atleast
mariadb
10.9
In Termux, you can execute $ bash install.sh
to automatically install some required
packages, modules, sub modules and library.
Note: For all new with MariaDB, you can use the link I provided from
install.bash
for steps how to setup MariaDB in Termux. Save your MariaDB username and password in all .env files inside of this folder This will allow Python and PHP to access your database. Import database and table structure fromscheme
folder.
If your MariaDB is not set properly, you can use option number 4 (Use JSON as Database) In Python CLI but you're limited in that database which means that database is only accessible for Python CLI and completely independent from other databases.
- Build web assests (js, css) files using this command
$ npm run build
- Start MariaDB service by using
$ mysqld
. This will start Daemon service and create .sock file. - Start new session then run host your
PHP
API andWeb
Interface using this command$ npm run serve
- You can now access
Web
interface usinghttp://localhost:8080/
and you APIhttp://localhost:8000/
To Start Python
Command Line Interface (CLI
)
You can access it by...
- Use
$ cd cli
then execute Pythonmain.py
script
Note: In some cases, option number 3 (Use Hosted REST API via 000Webhost) might fail randomly due to a problem to my code or technical error. IDK but hopes to it work well as expected.
And you can see realtime changes here.
And every user is limited upto 10 database changes such as insert, edit, delete and automatically reset in 30 minutes. But you may still get success message in after doing so (watch out for that).
I'll try to upload some video on how to setup this thing in Termux.
But now... Thanks... ❤