Ce dépôt contient :
- JustStreamIt/src/ : le code source du front-end (HTML, CSS, JavaScript).
- OCMovies-API-EN-FR/ : l’API Django fournie pour lister et filtrer les films.
Le but est de pouvoir lancer à la fois :
- Le serveur local pour la partie front-end (port 3000).
- Le serveur Django pour l’API (port 8000).
- Python 3.7+ (avec pip)
- Le dépôt de l'API test OCMovies disponible ici :
https://github.com/OpenClassrooms-Student-Center/OCMovies-API-EN-FR.git
Ce repo et celui de l'API doivent se trouver dans le même dossier racine afin que les commandes décrites ici soient fonctionnelles.
- Un terminal (Bash, Zsh, CMD ou Powershell) permettant d’exécuter les commandes
- (Optionnel) Virtualenv ou une autre solution de virtualisation Python
git clone https://github.com/dim-gggl/JustStreamIt.gitpuis
cd JustStreamItpython3 -m venv venv
source venv/bin/activatepython3 -m venv venv
venv\Scripts\activate- a. Les dépendances :
pip install -r OCMovies-API-EN-FR/requirements.txtou
pip3 install -r OCMovies-API-EN-FR/requirements.txtET
pip install -r OCMovies-API-EN-FR/requirements-dev.txt- b. La base de données :
python3 OCMovies-API-EN-FR/manage.py create_db• Le serveur local pour le front-end (équivalent à
python3 -m http.server 3000).
• Le serveur Django pour l’API (équivalent à
python3 OCMovies-API-EN-FR/manage.py runserver).
Toujours depuis la racine du projet (
python3 run_servers.pyLes messages suivants devraient apparaître dans le terminal :
• « Démarrage du serveur front sur le port 3000 … »
• « Démarrage du serveur Django de l’API sur le port 8000 … »
• « Les deux serveurs sont lancés. Appuyez sur Ctrl + C pour les arrêter. »
• L'API : http://127.0.0.1:8000/api/v1/titles ou http://127.0.0.1:8000/api/v1/genres/ • Front-end : http://127.0.0.1:3000/JustStreamIt/src/index.html
Pour arrêter les serveurs, vous pouvez taper Ctrl + C dans le terminal où le script est lancé.
JustStreamIt
├── run_servers.py
├── JustStreamIt
│ └── src
│ ├── index.html
│ ├── style.css
│ └── scripts
│ ├── config.js
│ ├── script.js
│ └── ...
└── OCMovies-API-EN-FR
├── manage.py
├── requirements.txt
└── ...
• JustStreamIt/src/ contient le code HTML/CSS/JS (front-end).
• OCMovies-API-EN-FR/ contient l’API et sa base de données nécessaire au bon fonctionnement de l'application Stream IT..
•
run_servers.pylance les deux serveurs en parallèle.
Si vous souhaitez lancer l’API sur un autre port (ex : 5000), vous pouvez éditer la commande dans run_servers.py :
api_server_cmd = ["python", "OCMovies-API-EN-FR/manage.py", "runserver", "5000"]De même pour le front-end (remplacer « 3000 » par le port de votre choix).
• Testé avec Python 3.9, 3.10, 3.11 et 3.12 sur macOS / Linux / Windows.
• Utilise uniquement des librairies standard hormis les dépendances Django listées dans OCMovies-API-EN-FR/requirements.txt.
This repo contains :
- JustStreamIt/src/: the front-end source code (HTML, CSS, JavaScript).
- OCMovies-API-EN-EN/: the test API provided to list and classify films.
The aim is to be able to launch simultaneously:
- The server for the application (port 3000).
- The Django server for access to the API database (port 8000).
- Python 3.7+ (with pip)
- The OCMovies API repository available here :
https://github.com/OpenClassrooms-Student-Center/OCMovies-API-EN-FR.git
This repo and the API's must be in the same root folder for the commands described here to work.
A terminal (Bash, Zsh, CMD or Powershell) for executing the commands. (Optional) Virtualenv or any other Python virtualisation solution.
Clone this repository (or download it) and place it at the root of the directory of your choice and :
git clone https://github.com/dim-gggl/JustStreamIt.gitthen
cd JustStreamItpython3 -m venv venv
source venv/bin/activatepython3 -m venv venv
venv\Scripts\activate- a. Dependencies :
pip install -r OCMovies-API-EN-EN/requirements.txtor
pip3 install -r OCMovies-API-EN-FR/requirements.txtAND
pip install -r OCMovies-API-EN-FR/requirements-dev.txt- b. The database :
python3 OCMovies-API-EN-EN/manage.py create_db- A Python script, run_servers.py, is located at the root of the project and simultaneously launches :
• Le serveur local pour le front-end (équivalent à
python3 -m http.server 3000).
• Le serveur Django pour l’API (équivalent à
python3 OCMovies-API-EN-FR/manage.py runserver).
Still from the root of the project (
python3 run_servers.pyThe following messages should appear in the terminal:
- ‘Start front server on port 3000 ... ’
- ‘Starting the Django API server on port 8000 ... ’
- ‘ Both servers are started. Appuyez sur Ctrl + C pour les arrêter. »
In order to stop the servers, you can type Ctrl + C in the terminal where the script is launched.
JustStreamIt
├── run_servers.py
├── JustStreamIt
│ └── src
│ ├── index.html
│ ├── style.css
│ └── scripts
│ ├── config.js
│ ├── script.js
│ └── ...
└── OCMovies-API-EN-FR
├── manage.py
├── requirements.txt
└── ...
JustStreamIt/src/ contains the HTML/CSS/JS code (front-end).
- OCMovies-API-EN-EN/ contains the API and its database required for the Stream IT application to function correctly...
•
run_servers.pylaunches the two servers in parallel.
If you ever want to launch the API on another port (e.g. 5000), you can edit the command in run_servers.py:
api_server_cmd = [‘python’, ‘OCMovies-API-EN-FR/manage.py’, ‘runserver’, ‘5000’]The same goes for the front-end (replace ‘3000’ with the port of your choice).
- Tested with Python 3.9, 3.10, 3.11 and 3.12 on macOS / Linux / Windows.
- Uses only standard libraries apart from the Django dependencies listed in OCMovies-API-EN-EN/requirements.txt.