*************************************************************************** ISTRUZIONI *************************************************************************** ------------------------------------------------------------------------------ 1° STEP: creiamo il DB MSYQL ------------------------------------------------------------------------------ mysql -u root -p CREATE DATABASE ai4teach_db; CREATE USER 'ai4teach_db_usr'@'localhost' IDENTIFIED BY 'STEms8743$%pass'; GRANT ALL PRIVILEGES ON ai4teach_db.* TO 'ai4teach_db_usr'@'localhost'; FLUSH PRIVILEGES; ------------------------------------------------------------------------------ 2° STEP: aggiorniamo i dati sul file .env ------------------------------------------------------------------------------ Aggiorniamo il file .env con le info del DB e con la SECRET KEY: la secret key si può geenrare usando: python3 -c 'import secrets; print(secrets.token_urlsafe(32))' ------------------------------------------------------------------------------ 3° STEP: - creare EX-NOVO il DB che ci serve per la nostra applicazione - oppure estrarre il DB andandolo a leggere con PHPMYADMIN ------------------------------------------------------------------------------ comandi SQL per estrarre tutte le tabelle del DB mysqldump -u root -p --no-data stems > /home/cirillo/stems_ddl_output.sql ------------------------------------------------------------------------------ 4° STEP: aggiornare tutti i file che contengono le informazioni sul DB - models.py - schemas.py - oauth2.py - /routers/user_routes.py - /routers/ui_routes.py - /routers/dattatemplate_routes.py - /routers/auth/auth_routes.py - /helpers/utils.py ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ 5° STEP: lavoriamo sul template: - layout: non toccare se non necessario - includes: non toccare se non necessario - accounts: non toccare se non necessario Tutte le pagine si trovano nella cartella "pages" - /src/templates/pages/index.html ------------------------------------------------------------------------------ ############################################################ OPZIONI ############################################################ Se volessi usare un DB POSTGRES - ISTRUZIONI PER CREARLO POSTGRES DB 1) Postgres checking psql --version se postgres non è installato eseguire i seguenti comandi: sudo apt update sudo apt install postgresql postgresql-contrib 2) accedere a postgres come amministratore: sudo -u postgres psql 3) creazione DB crea una password sicura: openssl rand -base64 32 crea l'utente in postgres CREATE USER uipertag WITH PASSWORD 'Z38gD7jaLs0zm0arZ7bg9r6GFGG97/YhfdIO0rr8c2k='; CREATE DATABASE ipertag OWNER uipertag; GRANT ALL PRIVILEGES ON DATABASE ipertag TO uipertag; uscire dalla console postgres: \q