Gros refactoring
This commit is contained in:
parent
4a6bfc951f
commit
dd22432b48
12 changed files with 18 additions and 18 deletions
|
@ -110,7 +110,7 @@ Ensuite crée un nouveau dossier pour faire les tests. Tu vas cloner deux projet
|
|||
- Exécuter cette commande dans le même terminal. L'application de génération de documents va être lancée sur ton ordinateur.
|
||||
|
||||
```bash
|
||||
docker run -p 8000:8000 --name fabriquedoc --network fabriquedoc local/fabriquedoc
|
||||
docker run -p 8080:8000 --name fabriquedoc --network fabriquedoc local/fabriquedoc
|
||||
```
|
||||
|
||||
### Frontend
|
||||
|
|
|
@ -37,7 +37,7 @@ RUN poetry config virtualenvs.create false \
|
|||
COPY conf/policy.xml /etc/ImageMagick-6/policy.xml
|
||||
|
||||
# Expose the application port
|
||||
EXPOSE 8000
|
||||
EXPOSE 8080
|
||||
|
||||
# Copy the application code
|
||||
COPY conf ./conf
|
||||
|
@ -49,4 +49,4 @@ COPY *.py .
|
|||
COPY *.lua .
|
||||
|
||||
# Run the application
|
||||
CMD ["poetry", "run", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
CMD ["poetry", "run", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]
|
|
@ -2,4 +2,4 @@ docker stop fabriquedoc
|
|||
docker rm fabriquedoc
|
||||
docker network create fabriquedoc
|
||||
# Ce programme sert à lancer le job_dispatcher dans un docker localement pour tester
|
||||
docker run -p 8000:8000 --env-file .env --name fabriquedoc --network fabriquedoc local/fabriquedoc
|
||||
docker run -p 8080:8080 --env-file .env --name fabriquedoc --network fabriquedoc local/fabriquedoc
|
|
@ -74,4 +74,4 @@ def test_getroot():
|
|||
if __name__ == "__main__":
|
||||
import uvicorn
|
||||
logger.info("Starting the application")
|
||||
uvicorn.run(app, host="0.0.0.0", port=8000)
|
||||
uvicorn.run(app, host="0.0.0.0", port=8080)
|
|
@ -1,7 +1,7 @@
|
|||
import requests
|
||||
|
||||
# Base URL for the API
|
||||
BASE_URL = "http://127.0.0.1:8000"
|
||||
BASE_URL = "http://127.0.0.1:8080"
|
||||
|
||||
# Function to get the access token
|
||||
def get_access_token():
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Test your FastAPI endpoints
|
||||
|
||||
# @name login
|
||||
POST http://127.0.0.1:8000/token/
|
||||
POST http://127.0.0.1:8080/token/
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
|
||||
username=francois&password=password
|
||||
|
@ -9,7 +9,7 @@ username=francois&password=password
|
|||
|
||||
###
|
||||
|
||||
POST http://127.0.0.1:8000/generer/
|
||||
POST http://127.0.0.1:8080/generer/
|
||||
Content-Type: application/json
|
||||
Accept: application/zip
|
||||
Authorization: Bearer {{authToken}}
|
||||
|
@ -31,7 +31,7 @@ Authorization: Bearer {{authToken}}
|
|||
|
||||
###
|
||||
|
||||
POST http://127.0.0.1:8000/generer/
|
||||
POST http://127.0.0.1:8080/generer/
|
||||
Content-Type: application/json
|
||||
Accept: application/zip
|
||||
Authorization: Bearer {{authToken}}
|
||||
|
@ -53,7 +53,7 @@ Authorization: Bearer {{authToken}}
|
|||
|
||||
###
|
||||
|
||||
POST http://127.0.0.1:8000/generer/
|
||||
POST http://127.0.0.1:8080/generer/
|
||||
Content-Type: application/json
|
||||
Accept: application/pdf
|
||||
Authorization: Bearer {{authToken}}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
curl -X POST --location "http://127.0.0.1:8000/images/" \
|
||||
curl -X POST --location "http://127.0.0.1:8080/images/" \
|
||||
-H "Accept: application/json" \
|
||||
-H "Content-Type: multipart/form-data; boundary=boundary" \
|
||||
-F "file=@logo-case-cocher.png"
|
||||
|
||||
curl -X GET --location "http://127.0.0.1:8000/images/"
|
||||
curl -X GET --location "http://127.0.0.1:8080/images/"
|
||||
|
||||
curl -X DELETE --location "http://127.0.0.1:8000/images/logo-case-cocher.png"
|
||||
curl -X DELETE --location "http://127.0.0.1:8080/images/logo-case-cocher.png"
|
||||
|
|
|
@ -6,7 +6,7 @@ services:
|
|||
context: ./backend
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "8000:8000"
|
||||
- "8080:8080"
|
||||
environment:
|
||||
- SECRET_KEY=${SECRET_KEY}
|
||||
- USERNAME=${USERNAME}
|
||||
|
|
|
@ -17,7 +17,7 @@ CONTAINER_NAME="fabriquedoc-frontend"
|
|||
IMAGE_NAME="local/fabriquedoc-frontend"
|
||||
PORT="8051"
|
||||
ENV_FILE=".env"
|
||||
BACKEND_ENDPOINT="http://fabriquedoc:8000"
|
||||
BACKEND_ENDPOINT="http://fabriquedoc:8080"
|
||||
|
||||
# Créer le réseau Docker s'il n'existe pas déjà
|
||||
if ! docker network inspect "$NETWORK_NAME" >/dev/null 2>&1; then
|
||||
|
|
|
@ -32,7 +32,7 @@ def init_session_state():
|
|||
if 'fabriquedoc_endpoint' not in st.session_state:
|
||||
load_dotenv() # Charge les variables d'environnement depuis un fichier .env
|
||||
# Définit l'URL du backend, avec une valeur par défaut si non spécifiée
|
||||
st.session_state['fabriquedoc_endpoint'] = os.environ.get("FABRIQUEDOC_ENDPOINT", "http://127.0.0.1:8000")
|
||||
st.session_state['fabriquedoc_endpoint'] = os.environ.get("FABRIQUEDOC_ENDPOINT", "http://127.0.0.1:8080")
|
||||
|
||||
# Initialise d'autres variables de session avec des valeurs par défaut
|
||||
for key, default_value in [('options', ""), ('bearer_token', ""), ('logged_in', False)]:
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# Ce script fonctionne sur Windows
|
||||
|
||||
# Définir l'adresse du backend
|
||||
$env:FABRIQUEDOC_ENDPOINT = "http://localhost:8000"
|
||||
$env:FABRIQUEDOC_ENDPOINT = "http://localhost:8080"
|
||||
|
||||
# Vérifier si Streamlit est installé
|
||||
if (!(Get-Command streamlit -ErrorAction SilentlyContinue)) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# Ce script fonctionne sur macOS et Linux
|
||||
|
||||
# Définir l'adresse du backend
|
||||
export FABRIQUEDOC_ENDPOINT="http://localhost:8000"
|
||||
export FABRIQUEDOC_ENDPOINT="http://localhost:8080"
|
||||
|
||||
# Vérifier si Streamlit est installé
|
||||
if ! command -v streamlit &> /dev/null; then
|
||||
|
|
Loading…
Reference in a new issue