From b3dc6a4ac29162516e656127d46d49fb84fc2df8 Mon Sep 17 00:00:00 2001 From: jlimolina Date: Sat, 24 May 2025 15:17:39 +0200 Subject: [PATCH] =?UTF-8?q?A=C3=B1adir=20script=20de=20instalaci=C3=B3n=20?= =?UTF-8?q?y=20datos=20iniciales=20de=20continentes,=20pa=C3=ADses=20y=20c?= =?UTF-8?q?ategor=C3=ADas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- categorias.sql | 17 ++++ contienentes.sql | 8 ++ install.sh | 126 ++++++++++++++++++++++++++++++ paises.sql | 197 +++++++++++++++++++++++++++++++++++++++++++++++ requirements.txt | 5 ++ 5 files changed, 353 insertions(+) create mode 100644 categorias.sql create mode 100644 contienentes.sql create mode 100644 install.sh create mode 100644 paises.sql create mode 100644 requirements.txt diff --git a/categorias.sql b/categorias.sql new file mode 100644 index 0000000..5241a01 --- /dev/null +++ b/categorias.sql @@ -0,0 +1,17 @@ +INSERT IGNORE INTO categorias_estandar (nombre) VALUES +('Ciencia'), +('Cultura'), +('Deportes'), +('Economía'), +('Educación'), +('Entretenimiento'), +('Internacional'), +('Medio Ambiente'), +('Moda'), +('Opinión'), +('Política'), +('Salud'), +('Sociedad'), +('Tecnología'), +('Viajes'); + diff --git a/contienentes.sql b/contienentes.sql new file mode 100644 index 0000000..33d8d17 --- /dev/null +++ b/contienentes.sql @@ -0,0 +1,8 @@ +INSERT IGNORE INTO continentes (id, nombre) VALUES +(1, 'África'), +(2, 'América'), +(3, 'Asia'), +(4, 'Europa'), +(5, 'Oceanía'), +(6, 'Antártida'); + diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..5d30199 --- /dev/null +++ b/install.sh @@ -0,0 +1,126 @@ +#!/bin/bash + +# ========= CONFIGURACIÓN ========= +APP_NAME="rss" +USER=$(whoami) +APP_DIR="/home/$USER/rss" +PYTHON_ENV="$APP_DIR/venv" +SERVICE_FILE="/etc/systemd/system/$APP_NAME.service" +FLASK_FILE="app.py" + +DB_NAME="noticiasrss" +MYSQL_USER="root" + +# ========= PEDIR CONTRASEÑA MYSQL ========= +read -s -p "Introduce la contraseña MySQL para '$MYSQL_USER': " MYSQL_PASS +echo + +# ========= BASE DE DATOS Y TABLAS ========= +echo "🛠️ Verificando/creando base de datos '$DB_NAME'..." +mysql -u"$MYSQL_USER" -p"$MYSQL_PASS" -e "CREATE DATABASE IF NOT EXISTS $DB_NAME DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" + +echo "📐 Verificando tablas necesarias..." +mysql -u"$MYSQL_USER" -p"$MYSQL_PASS" "$DB_NAME" < /dev/null <