sql y fastapi

This commit is contained in:
Your Name
2025-02-07 23:21:09 +01:00
parent 85228eeda9
commit 8e0faee3dd
14 changed files with 120 additions and 53 deletions

14
app/Dockerfile Normal file
View File

@ -0,0 +1,14 @@
FROM python:latest
WORKDIR ./
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
RUN mkdir app
COPY . ./app
RUN ls
CMD ["uvicorn", "app.main:app","--reload", "--host", "0.0.0.0", "--port", "8000"]

View File

@ -8,10 +8,10 @@ from sqlalchemy.orm import sessionmaker
load_dotenv()
# Configuración de MySQL desde variables de entorno
MYSQL_HOST = os.getenv("MYSQL_HOST", "localhost")
MYSQL_USER = os.getenv("MYSQL_USER", "root")
MYSQL_PASSWORD = os.getenv("MYSQL_PASSWORD", "manabo")
MYSQL_DATABASE = os.getenv("MYSQL_DATABASE", "noticias")
MYSQL_HOST = os.getenv("MYSQL_HOST", "mysql")
MYSQL_USER = os.getenv("MYSQL_USER", "nick")
MYSQL_PASSWORD = os.getenv("MYSQL_PASSWORD", "nick")
MYSQL_DATABASE = os.getenv("MYSQL_DATABASE", "news")
MYSQL_PORT = os.getenv("MYSQL_PORT", "3306")
DATABASE_URL = f"mysql+pymysql://{MYSQL_USER}:{MYSQL_PASSWORD}@{MYSQL_HOST}:{MYSQL_PORT}/{MYSQL_DATABASE}"

13
app/requirements.txt Normal file
View File

@ -0,0 +1,13 @@
fastapi
uvicorn
requests
beautifulsoup4
googlenewsdecoder
pytz
logging
sqlalchemy
pydantic
python-dotenv
mysql-connector-python
pymysql
cryptography