Skip to content
Snippets Groups Projects
Commit 6dc3a776 authored by Rachel Gaubil's avatar Rachel Gaubil
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
Showing
with 206 additions and 0 deletions
# CreNum
## Installation
**Pré-requis**
Python doit être installé sur votre machine.
**Déploiement**
`git clone git@gitlab.com:litt-arts-num/crenum.git`
`cd crenum`
`pip install -r requirements.txt`
Modifiez dans le fichier `crenum.service` les lignes `User=`, `WorkingDirectory=` et `ExecStart=`, puis déplacez le dans le dossier `/lib/systemd/system/`.
```
[Unit]
Description=Flask web server
After=network.target
[Install]
WantedBy=multi-user.target
[Service]
User=gaubilr
WorkingDirectory=/home/gaubilr/Projets/flask/crenum-flask
ExecStart=/usr/bin/python3 /home/gaubilr/Projets/flask/crenum-flask/crenum.py
TimeoutSec=600
Restart=always
```
Lancez ensuite les deux commandes suivantes pour permettre à l'application de se relancer d'elle-même à chaque boot du serveur.
```
sudo systemctl enable crenum.service
sudo systemctl start crenum.service
```
Vous pouvez vérifier l'état de l'application à l'aide de `sudo systemctl status crenum.service`
si changement de port bien penser à stopper et relancer le service
pour la conf apache :
/etc/apache2/sites-available
ne pas mettre le chemin : (cherche direct dans le dossier des conf)
sudo a2ensite apache.conf
activer : sudo systemctl reload apache2 (cmd)
sudo service apache2 restart (Arnaud)
-> faut-il faire les deux
efface l'ancien url git qui n'est plus le bon et en remet un
(git remote rm origin // git remote add origin git://jdzqoljdqz/)
## Contenu
Le site est construit avec un squelette `twig` (`/templates`) dans lequel on injecte les sorties de fichiers `xsl` (`/templates/data`) qui permettent d'adapter les données (`/templates/data/xml`) à la visualisation.
<VirtualHost *:80>
ServerName crenum.test
ProxyPreserveHost On
ProxyPass / http://localhost:5000/
ProxyPassReverse / http://localhost:5000/
Timeout 2400
ProxyTimeout 2400
</VirtualHost>
from flask import Flask
from flask import redirect
from flask import render_template
from flask import url_for
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html.twig')
@app.route('/book<bookNb>')
@app.route('/book<bookNb>/p<int:pageNb>')
def page(bookNb=1, pageNb=-1):
return render_template('book'+bookNb+'.html.twig', pageNb=pageNb)
@app.route('/<vueName>')
def vue(vueName=None):
return render_template(vueName+'.html.twig')
if __name__ == '__main__':
#changer de port :
#app.run(host="127.0.0.1",port=5005,debug=True)
app.run(debug=True)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
.title {
text-align:center;
}
/*fixe le footer en bas*/
.main_containeur{
min-height: 800px;
}
.footer {
text-align: center;
}
.footer img{
height: 50px;
margin: 10px;
}
/*!
* Font Awesome Free 6.1.1 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
* Copyright 2022 Fonticons, Inc.
*/
:host,:root{--fa-font-solid:normal 900 1em/1 "Font Awesome 6 Free"}@font-face{font-family:"Font Awesome 6 Free";font-style:normal;font-weight:900;font-display:block;src:url(../webfonts/fa-solid-900.woff2) format("woff2"),url(../webfonts/fa-solid-900.ttf) format("truetype")}.fa-solid,.fas{font-family:"Font Awesome 6 Free";font-weight:900}
\ No newline at end of file
static/img/elan.png

27.1 KiB

static/img/favicon.ico

481 B

static/img/genealogie.jpg

183 KiB

static/img/litt&arts.png

12.1 KiB

static/img/map.jpeg

67.5 KiB

static/img/uga.png

64.9 KiB

//récupérer le premier identifiant de page (ne commence pas toujours à 1)
var pages = document.getElementsByClassName("page");
var begId = pages[0].id.split("-")[1];
var endId = pages[pages.length-1].id.split("-")[1];
var minPageNb = Number(begId.substring(1,begId.length));
var maxPageNb = Number(endId.substring(1,endId.length));
var currentPageNb = minPageNb;
var prevPageNb = document.getElementById("pageNb").innerHTML;
if(prevPageNb != -1){
currentPageNb = prevPageNb;
}
window.onload = function(){
updatePageNb();
}
function updatePageNb(){
//maj du prevPageNb si un numéro de page est donné par l'URL
var prevPageNb = document.getElementById("pageNb").innerHTML;
var newPath = window.location.pathname;
var path = window.location.pathname.split("/");
//si on est à la première page (currentPageNb=minPageNb)
//ou qu'on a navigué entre les pages
if ((prevPageNb == -1) || (prevPageNb != currentPageNb)) {
if (prevPageNb != currentPageNb) {
if (path.length>2) {
newPath = path.slice(0,-1).join("/");
}
}
window.location.pathname = newPath+="/p"+currentPageNb;
}
showPage(currentPageNb);
}
//récupération et masquage des éléments correspondants à pageNb
function hidePage(pageNb){
document.getElementById("page-f"+pageNb+"-left").style.display="none";
document.getElementById("page-f"+pageNb+"-right").style.display="none";
document.getElementById("diplo-f"+pageNb+"-left").style.display="none";
document.getElementById("diplo-f"+pageNb+"-right").style.display="none";
document.getElementById("linear-f"+pageNb+"-left").style.display="none";
document.getElementById("linear-f"+pageNb+"-right").style.display="none";
}
//récupération et affichage des éléments correspondants à pageNb
function showPage(pageNb){
document.getElementById("page-f"+pageNb+"-left").style.display="block";
document.getElementById("page-f"+pageNb+"-right").style.display="block";
document.getElementById("diplo-f"+pageNb+"-left").style.display="block";
document.getElementById("diplo-f"+pageNb+"-right").style.display="block";
document.getElementById("linear-f"+pageNb+"-left").style.display="block";
document.getElementById("linear-f"+pageNb+"-right").style.display="block";
}
//masquer la page actuelle et afficher la page précédente (s'il y en a une)
function prev(){
if(currentPageNb > minPageNb){
hidePage(currentPageNb);
currentPageNb--;
showPage(currentPageNb);
} else{
alert("Pas de page précédente");
}
updatePageNb()
}
//masquer la page actuelle et afficher la page suivante (s'il y en a une)
function next(){
if(currentPageNb < maxPageNb){
hidePage(currentPageNb);
currentPageNb++;
showPage(currentPageNb);
} else{
alert("Pas de page suivante");
}
updatePageNb();
}
//changement de page au click sur les touches flèches gauche et droite
function touch(event){
var key = window.event ? event.keyCode : event.which;
if(key == 37){
prev();
}
else if(key==39){
next();
}
}
This diff is collapsed.
File added
File added
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment