Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions initapp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import subprocess
from typing import List, Tuple, Union

def execute_command(command: str) -> Tuple[bool, Union[str, str]]:
try:
# Execute the command and capture standard output and errors
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
stdout, stderr = process.communicate()

# Check if there were errors during execution
if process.returncode == 0:
# Success: the command ran without errors
return True, stdout
else:
# Error: the command returned a non-zero exit code
return False, stderr
except Exception as e:
# Error during command execution
return False, str(e)

def execute_commands(commands: List[str]) -> List[Tuple[bool, Union[str, str]]]:
results = []
for i, command in enumerate(commands, start=1):
success, result = execute_command(command)
results.append((success, result))
status = 'executed successfully' if success else 'error during command execution'
print(f"Command '{command}': {status}")
print(result)

return results

# Example of usage
commands = [
"git add .",
"git commit -m deco"
]
results = execute_commands(commands)
53 changes: 27 additions & 26 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,44 @@
from fastapi import FastAPI
from fastapi.responses import HTMLResponse
from config.database import engine, Base
from middlewares.error_handler import ErrorHandler
from routers.movie import movie_router
from routers.user import user_router
# from config.database import engine, Base
# from middlewares.error_handler import ErrorHandler
# from routers.movie import movie_router
# from routers.user import user_router

app = FastAPI()
app.title = "Mi aplicación con FastAPI"
app.version = "0.0.1"

app.add_middleware(ErrorHandler)
# app.add_middleware(ErrorHandler)

app.include_router(movie_router)
app.include_router(user_router)
# app.include_router(movie_router)
# app.include_router(user_router)


Base.metadata.create_all(bind=engine)
# Base.metadata.create_all(bind=engine)


movies = [
{
"id": 1,
"title": "Avatar",
"overview": "En un exuberante planeta llamado Pandora viven los Na'vi, seres que ...",
"year": "2009",
"rating": 7.8,
"category": "Acción"
},
{
"id": 2,
"title": "Avatar",
"overview": "En un exuberante planeta llamado Pandora viven los Na'vi, seres que ...",
"year": "2009",
"rating": 7.8,
"category": "Acción"
}
]
# movies = [
# {
# "id": 1,
# "title": "Avatar",
# "overview": "En un exuberante planeta llamado Pandora viven los Na'vi, seres que ...",
# "year": "2009",
# "rating": 7.8,
# "category": "Acción"
# },
# {
# "id": 2,
# "title": "Avatar",
# "overview": "En un exuberante planeta llamado Pandora viven los Na'vi, seres que ...",
# "year": "2009",
# "rating": 7.8,
# "category": "Acción"
# }
# ]

@app.get('/', tags=['home'])
def message():
return HTMLResponse('<h1>Hello world</h1>')

#holita
4 changes: 4 additions & 0 deletions passenger_wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from a2wsgi import ASGIMiddleware
from main import app

application = ASGIMiddleware(app)
Binary file modified requiremets.txt
Binary file not shown.