aniketkumar2510/TCM-Website
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
Steps to run website ** Install required dependencies ** 1. Unzip website zip file and navigate to the website folder 2. Ensure python version is 3.11.2 (python --version) 3. Install virtual environment to install dependencies: rm -rf venv (if virtual environment already exists skip this step) python3 -m venv venv source venv/bin/activate pip install -r requirements.txt (To ensure HTTPS) 4. (for local development on windows) .\mkcert-v1.4.4-windows-amd64.exe -key-file key.pem -cert-file cert.pem "localhost" "*.localhost" 127.0.0.1 ::1 (for production. Do these steps on Raspberry Pi or whatever hardware) - Raspberry Pi steps: Ensure u have the correct mkcert certificate according to your hardware's specifications. (For rasperry pi it is linux_arm64) To generate the HTTPS certificate files: <file path to mkcert> -key-file key.pem -cert-file cert.pem localhost "*.localhost" 127.0.0.1 ::1 To trust the HTTPS certificate: certutil -d sql:$HOME/.pki/nssdb -A -t "C,," -n "mkcert development certificate" -i "$(mkcert -CAROOT)/rootCA.pem" cd $(mkcert -CAROOT) python3 -m http.server 8000 - On windows laptop to access the website http://<hotspot ip>:8000 (download rootCA.pem) Open certmgr.msc (Press Win + R, type certmgr.msc, and hit Enter). Navigate to Trusted Root Certification Authorities > Certificates. Right-click and choose Import. Select rootCA.pem and follow the wizard, choosing "Place all certificates in the following store> -> Trusted Root Certification Authorities Restart your laptop to apply changes 6. (To start the website) Start Minio Server: minio server --address ":9000" --console-address ":9001" <file path to minio-data folder> Start website using uvicorn uvicorn app.app:app --reload --port 8080 --ssl-keyfile key.pem --ssl-certfile cert.pem (for local testing) uvicorn app.app:app --host 0.0.0.0 --port 8080 --ssl-keyfile=key.pem --ssl-certfile=cert.pem (for production) Local testing: Open web browser and navigate to "https://127.0.0.1:8000" Production: Open web browser and navigate to "https://<ip address of connected network>:8080" 7. Steps to run database(users.db) Install MariaDB. Create your own database in MariaDB and import tcm_database.sql Change .env file according to ur MariaDB user and password Ensure rootuser is created with commands stated below CREATE USER 'rootuser'@'%' IDENTIFIED BY 'toor'; GRANT ALL PRIVILEGES ON *.* TO 'rootuser'@'%' WITH GRANT OPTION; FLUSH PRIVILEGES; mysql -u rootuser -p Ensure that you created tcm_database CREATE DATABASE tcm_database;