sql y fastapi
This commit is contained in:
14
app/Dockerfile
Normal file
14
app/Dockerfile
Normal 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"]
|
||||
|
@ -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
13
app/requirements.txt
Normal file
@ -0,0 +1,13 @@
|
||||
fastapi
|
||||
uvicorn
|
||||
requests
|
||||
beautifulsoup4
|
||||
googlenewsdecoder
|
||||
pytz
|
||||
logging
|
||||
sqlalchemy
|
||||
pydantic
|
||||
python-dotenv
|
||||
mysql-connector-python
|
||||
pymysql
|
||||
cryptography
|
Reference in New Issue
Block a user