no more apache2

This commit is contained in:
Arthur 2025-02-25 18:24:29 +01:00
commit d8bd75003b
79 changed files with 52 additions and 27 deletions

1
sciodog-app/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
db.sqlite3

21
sciodog-app/Dockerfile Normal file
View file

@ -0,0 +1,21 @@
# WSGI_FILE : file used as the app to run, passed to uwsgi --module option
# PORT : Port on which the app is exposed
# APP_DIR : Path of the app on the host machine. It will be mounted on /var/www/html in the container
FROM alpine:latest
# UWSGI Configuration
COPY configuration/ /etc/uwsgi/
RUN mkdir -p /etc/uwsgi ; \
adduser uwsgi -S -D -H -s /usr/sbin/nologin ; \
apk add python3 python3-dev py3-pip gcc musl-dev linux-headers ; \
pip install --break-system-packages uwsgi django
# Application configuration
WORKDIR /var/www/html
COPY ./app/ .
RUN pip install --break-system-packages -r requirements.txt
EXPOSE ${PORT}
ENTRYPOINT ["uwsgi", "--ini", "/etc/uwsgi/uwsgi.ini"]

View file

View file

@ -0,0 +1,12 @@
from django.contrib import admin
from django.contrib.admin.decorators import register
from .models import Article
# Register your models here.
@register(Article)
class ArticleAdmin(admin.ModelAdmin):
list_display = ('title', 'slug', 'status','created_on')
list_filter = ("status",)
search_fields = ['title', 'content']
prepopulated_fields = {'slug': ('title',)}

View file

@ -0,0 +1,6 @@
from django.apps import AppConfig
class BlogConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'blog'

View file

@ -0,0 +1,33 @@
# Generated by Django 4.2.7 on 2023-11-26 07:10
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Article',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=200, unique=True)),
('slug', models.SlugField(max_length=200, unique=True)),
('updated_on', models.DateTimeField(auto_now=True)),
('content', models.TextField()),
('created_on', models.DateTimeField(auto_now_add=True)),
('status', models.IntegerField(choices=[(0, 'Draft'), (1, 'Publish')], default=0)),
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='articles', to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ['-created_on'],
},
),
]

View file

@ -0,0 +1,23 @@
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
STATUS = (
(0,"Draft"),
(1,"Publish")
)
class Article(models.Model):
title = models.CharField(max_length=200, unique=True)
slug = models.SlugField(max_length=200, unique=True)
author = models.ForeignKey(User, on_delete= models.CASCADE,related_name='articles')
updated_on = models.DateTimeField(auto_now= True)
content = models.TextField()
created_on = models.DateTimeField(auto_now_add=True)
status = models.IntegerField(choices=STATUS, default=0)
class Meta:
ordering = ['-created_on']
def __str__(self):
return self.title

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 967 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 841 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 852 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

View file

@ -0,0 +1,126 @@
@font-face {
font-family: 'Montserrat Regular';
font-style: normal;
font-weight: normal;
src: local('Montserrat Regular'), url('/static/blog/fonts/Montserrat-Medium.woff') format('woff');
}
@font-face {
font-family: 'TH Sarabun New Regular';
font-style: normal;
font-weight: normal;
src: local('TH Sarabun New Regular'), url('/static/blog/fonts/THSarabunNew.woff') format('woff');
}
header , footer {
background-color: #D5CABD;
}
body {
background: rgba(255, 125, 125, 0.1) !important;
background-repeat: no-repeat;
background-size: cover;
background-attachment: scroll;
}
* {
font-family: "TH Sarabun New Regular";
font-size: 30px;
line-height: 30px;
}
.title {
font-family: "Montserrat Regular";
font-size: 46px;
line-height: 28px;
}
.subtitle {
font-size: 32px;
line-height: 32px;
}
.fb-text {
overflow: hidden;
line-height: 1.2em;
max-height: 3.6em;
}
@media (max-width: 767px) {
.carousel-inner .carousel-item > div {
display: none;
}
.carousel-inner .carousel-item > div:first-child {
display: block;
}
}
.carousel-inner .carousel-item.active,
.carousel-inner .carousel-item-next,
.carousel-inner .carousel-item-prev {
display: flex;
}
/* medium and up screens */
@media (min-width: 768px) {
.carousel-inner .carousel-item-end.active,
.carousel-inner .carousel-item-next {
transform: translateX(25%) !important;
}
.carousel-inner .carousel-item-start.active {
transform: translateX(0) !important;
}
.carousel-inner .carousel-item-prev {
transform: translateX(-25%) !important;
}
.carousel-fade .carousel-inner .carousel-item-end.active,
.carousel-fade .carousel-inner .carousel-item-next {
transform: translateX(0) !important;
}
.carousel-fade .carousel-inner .carousel-item-start.active {
transform: translateX(0) !important;
}
.carousel-fade .carousel-inner .carousel-item-prev {
transform: translateX(0) !important;
}
}
.carousel-inner .carousel-item-end,
.carousel-inner .carousel-item-start {
transform: translateX(0);
}
.img-fluid {
border-radius: 16px;
}
/* ANCIEN */
/* @font-face {
font-family: 'TH Sarabun New Italic';
font-style: normal;
font-weight: normal;
src: local('TH Sarabun New Italic'), url('../fonts/THSarabunNew Italic.woff') format('woff');
}
@font-face {
font-family: 'TH Sarabun New Bold';
font-style: normal;
font-weight: normal;
src: local('TH Sarabun New Bold'), url('../fonts/THSarabunNew Bold.woff') format('woff');
}
@font-face {
font-family: 'TH Sarabun New Bold Italic';
font-style: normal;
font-weight: normal;
src: local('TH Sarabun New Bold Italic'), url('../fonts/THSarabunNew BoldItalic.woff') format('woff');
} */

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

View file

@ -0,0 +1,71 @@
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta
name="Sciodog"
content="Educatrice canine certifiée Educdog, titulaire de l'ACACED et du TAV, retrouvez toutes les informations ainsi que la possibilité de prendre rendez-vous en ligne."
/>
<meta title="Sciodog éducation canine Les Pieux"/>
<title>Sciodog</title>
{% load static %}
<link rel="stylesheet" href="{% static 'blog/main.css' %}"/>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
</head>
<body>
<header style="position: fixed; top: 0; width: 100%; z-index: 1;" onclick="window.scrollTo(0, 0);">
<section class="d-flex flex-row align-items-center justify-content-center">
<section>
<h2 class="fw-bold title mt-2">SCIODOG</h2>
<p class="title mb-1" style="font-size: 16px;">
Carole BOYREAU<br/>
+33 (0)6 77 59 66 39<br/>
Les Pieux (50)
</p>
</section>
</section>
</header>
<main class="mt-2 container">
<div class="d-flex d-md-none" style="height: 150px"></div>
<div class="d-none d-md-flex" style="height: 150px"></div>
<h1>{{ object.title }}</h1>
<p>{{ object.content }}</p>
<br/>
<h5>Par {{ article.author }}</h3>
<div class="mx-auto col-6">
<a href="{% url 'articles' %}">
<button style="background-color: #C472A3;" class="btn col-12">Retour aux articles</button>
</a>
</div>
</main>
<footer style="position: fixed; top: 93vh; left: 0; width: 100vw;">
<div class="d-flex flex-row justify-content-center align-items-center">
<p class="my-1 title subtitle me-3" style="font-size: 16px;">sciodog50@gmail.com</p>
<a class="d-flex flex-row justify-content-center align-self-end p-2"
href="https://www.instagram.com/sciodog/"
rel="noreferrer"
target="_blank">
<img src="{% static 'blog/images/insta-logo.png' %}" width="40" height="40"
alt="logo instagram"/>
</a>
<a class="d-flex flex-row justify-content-center align-self-end p-2"
href="https://www.facebook.com/Sciodog"
rel="noreferrer"
target="_blank">
<img src="{% static 'blog/images/fb-logo.png' %}" width="40" height="40"
alt="logo facebook"/>
</a>
<a class="d-flex flex-row justify-content-center align-self-end p-2"
href=""
rel="noreferrer"
target="_blank">
<img src="{% static 'blog/images/LinkedIn_logo.png' %}" width="40" height="40"
alt="logo LinkedIn"/>
</a>
</div>
</footer>
</body>
</html>

View file

@ -0,0 +1,73 @@
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta
name="Sciodog"
content="Educatrice canine certifiée Educdog, titulaire de l'ACACED et du TAV, retrouvez toutes les informations ainsi que la possibilité de prendre rendez-vous en ligne."
/>
<meta title="Sciodog éducation canine Les Pieux"/>
<title>Sciodog</title>
{% load static %}
<link rel="stylesheet" href="{% static 'blog/main.css' %}"/>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
</head>
<body>
<header style="position: fixed; top: 0; width: 100%; z-index: 1;" onclick="window.scrollTo(0, 0);">
<section class="d-flex flex-row align-items-center justify-content-center">
<section>
<h2 class="fw-bold title mt-2">SCIODOG</h2>
<p class="title mb-1" style="font-size: 16px;">
Carole BOYREAU<br/>
+33 (0)6 77 59 66 39<br/>
Les Pieux (50)
</p>
</section>
</section>
</header>
<main class="mt-2 container">
<div class="d-flex d-md-none" style="height: 150px"></div>
<div class="d-none d-md-flex" style="height: 150px"></div>
<div class="row wrap justify-content-evenly">
{% for article in object_list %}
<div class="card m-1" style="width: 18rem;">
<img class="card-img-top" src="..." alt="Card image cap">
<div class="card-body">
<h5 class="card-title">{{ article.title }}</h5>
<p class="card-text">Par {{ article.author }}</p>
<a href="{% url 'article_detail' article.slug %}" class="btn btn-primary">Je le lis</a>
</div>
</div>
{% endfor %}
</div>
</main>
<footer style="position: fixed; top: 93vh; left: 0; width: 100vw;">
<div class="d-flex flex-row justify-content-center align-items-center">
<p class="my-1 title subtitle me-3" style="font-size: 16px;">sciodog50@gmail.com</p>
<a class="d-flex flex-row justify-content-center align-self-end p-2"
href="https://www.instagram.com/sciodog/"
rel="noreferrer"
target="_blank">
<img src="{% static 'blog/images/insta-logo.png' %}" width="40" height="40"
alt="logo instagram"/>
</a>
<a class="d-flex flex-row justify-content-center align-self-end p-2"
href="https://www.facebook.com/Sciodog"
rel="noreferrer"
target="_blank">
<img src="{% static 'blog/images/fb-logo.png' %}" width="40" height="40"
alt="logo facebook"/>
</a>
<a class="d-flex flex-row justify-content-center align-self-end p-2"
href=""
rel="noreferrer"
target="_blank">
<img src="{% static 'blog/images/LinkedIn_logo.png' %}" width="40" height="40"
alt="logo LinkedIn"/>
</a>
</div>
</footer>
</body>
</html>

View file

@ -0,0 +1,259 @@
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta
name="Sciodog"
content="Educatrice canine certifiée Educdog, titulaire de l'ACACED et du TAV, retrouvez toutes les informations ainsi que la possibilité de prendre rendez-vous en ligne."
/>
<meta title="Sciodog éducation canine Les Pieux"/>
<title>Sciodog</title>
{% load static %}
<link rel="stylesheet" href="{% static 'blog/main.css' %}"/>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
</head>
<body>
<header style="position: fixed; top: 0; width: 100%; z-index: 1;" onclick="window.scrollTo(0, 0);">
<section class="d-flex flex-row align-items-center justify-content-center">
<section>
<h2 class="fw-bold title mt-2">SCIODOG</h2>
<p class="title mb-1" style="font-size: 16px;">
Carole BOYREAU<br/>
+33 (0)6 77 59 66 39<br/>
Les Pieux (50)
</p>
</section>
</section>
</header>
<main class="mt-2 container">
<section id="mission" class="d-flex flex-column col-12 align-items-center justify-content-center mt-3">
<div class="d-flex d-md-none" style="height: 150px"></div>
<div class="d-none d-md-flex d-lg-none" style="height: 150px"></div>
<img class="d-flex w-75 mb-2" alt="cover picture" src="{% static 'blog/images/cover.jpeg' %}"/>
<h1 class="title mt-3" style="width: fit-content">Ma mission</h4>
<p>
Je m'appelle Carole Boyreau, et je suis la créatrice de Sciodog, entreprise dédiée à l'éducation et au comportement canin, dans le Cotentin.
Je suis là pour vous aider à vivre une vie sereine et harmonieuse avec votre chien, en créant un environnement propice à son épanouissement. Ensemble, nous construirons le cadre idéal pour répondre aux besoins de votre animal, en intégrant vos contraintes spécifiques.
Ma méthode d'éducation est à la fois douce et respectueuse de votre animal, tout en étant ferme lorsque nécessaire. Je privilégie une approche personnalisée pour renforcer la relation entre votre compagnon et vous afin que vous profitiez des moments précieux à partager en sa compagnie.
Je suis impatiente de vous rencontrer sur Sciotot, Cherbourg, Barneville Carteret ou aux alentours, pour travailler avec vous sur le bien-être de votre chien et de votre foyer.
<br/><br/>Carole
</p>
<iframe class="mb-3 d-none d-md-flex" width="1280" height="720" src="https://www.youtube.com/embed/XU2pk0SrpMk" title="Sciodog : première" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
<iframe class="mb-3 d-flex d-md-none" src="https://www.youtube.com/embed/XU2pk0SrpMk" title="Sciodog : première" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
</section>
<section id="relation" class="d-flex flex-column align-items-center justify-content-center" style="background-color: #CCD3FF; border-radius: 15px;">
<h1 class="title pt-4 text-center" style="width: fit-content; line-height: 48px;">Vers plus de sérénité</h1>
<p class="ps-3 pe-2 pt-2">Votre chien a des problèmes de comportement et vous êtes dépassé ? Vous venez d’adopter un chiot ou un chien adulte et souhaitez être accompagné dans son éducation ? Votre chien est souvent seul et vous souhaitez favoriser sa socialisation ?
<br/>Sciodog a la volonté d’aider tous les propriétaires de chiens dans le Cotentin, peu importe leur race et leur âge.</p>
<section class="d-flex flex-row col-12 flex-wrap">
<section class="d-flex flex-column col-lg-4">
<h2 class="pt-3 ps-3 pe-3 title subtitle">EDUCATION</h2>
<img class="w-100 p-3" src="{% static 'blog/images/bebe_scio.jpg' %}" alt="picto education"/>
<p class="ps-3 pe-3 pb-3">Bénéficiez de mon expertise pour créer une base solide d’obéissance et de socialisation pour votre animal qu’il soit chiot ou adulte.
<br/><span style="font-weight: bold">6, 12 ou 18 séances.</span></p>
</section>
<section class="d-flex flex-column col-lg-4">
<h2 class="pt-3 ps-3 pe-3 title subtitle">COMPORTEMENT</h2>
<img class="p-3 w-100" src="{% static 'blog/images/Obeissance.jpeg' %}" alt="picto comportement"/>
<p class="ps-3 pe-3 pb-3">Faîtes moi confiance pour comprendre les comportements de votre chien et vous apporter des solutions concrètes et personnalisées. Ensemble, nous réglerons les problèmes d’agressivité, d’anxiété, de crainte…
<br/><span style="font-weight: bold">6, 12 ou 18 séances.</span></p>
</section>
<section class="d-flex flex-column col-lg-4">
<h2 class="ps-3 pe-3 title subtitle">ABONNEMENT - LOISIRS</h2>
<img class="p-3 w-100" src="{% static 'blog/images/loisir.jpg' %}" alt="picto abonnement - loisirs"/>
<p class="ps-3 pe-3 pb-3">Prolongez le bien-être de votre chien : balades collectives, séances d’entraînement et sociabilisation vous sont proposées avec une communauté de chiens du Cotentin.
<br/><span style="font-weight: bold">Minimum 8 loisirs par an.</span></p>
</section>
</section>
<p class="ps-3 pe-3 pb-2" style="font-style: italic">Un premier rendez-vous à votre domicile a lieu avant chaque accompagnement afin de répondre spécifiquement à vos besoins et à celui de votre animal. Chaque séance dure entre 45 minutes et 1 heure, à votre domicile ou en extérieur, dans le Cotentin.</p>
<a href="mailto:sciodog50@gmail.com"><button class="btn mb-3" style="background-color: #C472A3;">Discutons de vos besoins</button></a>
</section>
<section id="partenaires" class="d-flex flex-column col-12 align-items-center justify-content-center mt-5">
<h1 class="title" style="line-height: 48px;">Ils font confiance à Sciodog</h1>
<div class="row justify-content-center">
<div id="recipeCarousel" class="carousel slide" data-bs-ride="carousel">
<div class="carousel-inner" role="listbox">
<div class="carousel-item active">
<div class="col-md-3 p-2">
<a href="https://www.francebleu.fr/cotentin">
<div class="card p-2">
<div class="card-img">
<img src="{% static 'blog/images/carousel/France_Bleu_Cotentin_2021.png' %}" class="img-fluid">
</div>
</div>
</a>
</div>
</div>
<div class="carousel-item">
<div class="col-md-3 p-2">
<a href="https://vetobricquebec.fr/">
<div class="card p-2">
<div class="card-img">
<img src="{% static 'blog/images/carousel/clinique.png' %}" class="img-fluid">
</div>
</div>
</a>
</a>
</div>
</div>
<div class="carousel-item">
<div class="col-md-3 p-2">
<a href="https://www.tomandco.com/fr-fr/Nos-magasins/#!/l/cherbourg-en-cotentin/260-rue-du-grand-pre/3793999">
<div class="card p-2">
<div class="card-img" style="max-height=250px">
<img src="{% static 'blog/images/carousel/les_cotentinois_500.png' %}" class="img-fluid">
</div>
</div></a>
</div>
</div>
<div class="carousel-item">
<div class="col-md-3 p-2">
<a href="https://www.radioflam.fr/">
<div class="card p-2">
<div class="card-img">
<img src="{% static 'blog/images/carousel/logo-radio-flam.png' %}" class="img-fluid">
</div>
</div>
</a>
</div>
</div>
</div>
</div>
</div>
</section>
<section id="clients" class="d-flex flex-column col-12 align-items-center justify-content-center mt-2">
<div class="row justify-content-center">
<div class="col-md-4 p-2">
<a href="https://g.co/kgs/3SFJKb">
<img src="{% static 'blog/images/carousel/avis1.png' %}" class="img-fluid">
</a>
</div>
<div class="col-md-4 p-2">
<a href="https://g.co/kgs/3SFJKb">
<img src="{% static 'blog/images/carousel/avis2.png' %}" class="img-fluid">
</a>
</div>
<div class="col-md-4 p-2">
<a href="https://g.co/kgs/3SFJKb">
<img src="{% static 'blog/images/carousel/avis3.png' %}" class="img-fluid">
</a>
</div>
</div>
</section>
<section id="actus" class="d-flex flex-column col-12 align-items-center justify-content-center my-3">
<h1 class="title" style="line-height: 48px;">Mes derniers posts</h1>
<div class="row justify-content-center">
<div id="postsCarousel" class="carousel slide carousel-fade" data-bs-ride="carousel">
<div id="fb-carousel" class="carousel-inner" role="listbox">
</div>
</div>
</div>
</section>
</main>
<footer>
<div class="d-flex flex-row justify-content-center align-items-center">
<p class="my-1 title subtitle me-3" style="font-size: 16px;">sciodog50@gmail.com</p>
<a class="d-flex flex-row justify-content-center align-self-end p-2"
href="https://www.instagram.com/sciodog/"
rel="noreferrer"
target="_blank">
<img src="{% static 'blog/images/insta-logo.png' %}" width="40" height="40"
alt="logo instagram"/>
</a>
<a class="d-flex flex-row justify-content-center align-self-end p-2"
href="https://www.facebook.com/Sciodog"
rel="noreferrer"
target="_blank">
<img src="{% static 'blog/images/fb-logo.png' %}" width="40" height="40"
alt="logo facebook"/>
</a>
<a class="d-flex flex-row justify-content-center align-self-end p-2"
href=""
rel="noreferrer"
target="_blank">
<img src="{% static 'blog/images/LinkedIn_logo.png' %}" width="40" height="40"
alt="logo LinkedIn"/>
</a>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
<script>
fetch("https://sciodog.fr/posts").then((response) => {
response.json().then((json) => {
let first = true;
json.forEach((el) => {
if (el["message"] === undefined)
return;
let carousel = document.getElementById("fb-carousel");
let postContainer = document.createElement("div");
postContainer.classList.add("carousel-item");
postContainer.classList.add("justify-content-evenly");
if (first)
postContainer.classList.add("active");
let post = document.createElement("div");
post.classList.add("card");
post.classList.add("col-md-3");
let imgcontainer = document.createElement("div");
imgcontainer.style = "max-height: 250px; overflow: hidden";
let image = document.createElement("img");
image.alt = "fb post image";
image.src = el["media"];
image.classList.add("card-img-top");
let body = document.createElement("div");
body.classList.add("card-body");
let text = document.createElement("p");
text.classList.add("card-text");
text.classList.add("fb-text");
text.innerText = el["message"];
let link = document.createElement("a");
link.href = el["url"];
link.classList.add("btn");
link.style = "background-color: #C472A3";
link.innerText = "Voir plus";
imgcontainer.appendChild(image);
body.appendChild(text);
body.appendChild(link);
post.appendChild(imgcontainer);
post.appendChild(body);
postContainer.appendChild(post);
carousel.appendChild(postContainer);
first = false;
});
let items = document.querySelectorAll('#postsCarousel .carousel-item')
items.forEach((el) => {
const minPerSlide = 3;
let next = el.nextElementSibling
for (var i = 1; i < minPerSlide; i++) {
if (!next) {
next = items[0];
}
let cloneChild = next.cloneNode(true);
el.appendChild(cloneChild.children[0]);
next = next.nextElementSibling;
}
});
});
});
let items = document.querySelectorAll('#recipeCarousel .carousel-item')
items.forEach((el) => {
const minPerSlide = 4;
let next = el.nextElementSibling
for (var i = 1; i < minPerSlide; i++) {
if (!next) {
next = items[0];
}
let cloneChild = next.cloneNode(true);
el.appendChild(cloneChild.children[0]);
next = next.nextElementSibling;
}
});
</script>
</body>
</html>

View file

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

View file

@ -0,0 +1,12 @@
from . import views
from django.urls import path
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
urlpatterns = [
path("", lambda r: render(r, "blog/index.html")),
path("posts", views.IndexView.as_view()),
path("preview", login_required(views.ArticleList.as_view(preview=True), login_url='/admin/login'), name='articles'),
path("articles", views.ArticleList.as_view(), name='articles'),
path('articles/<slug:slug>/', views.ArticleDetail.as_view(), name='article_detail'),
]

View file

@ -0,0 +1,3 @@
from .articles_list import ArticleList
from .articles_detail import ArticleDetail
from .index import IndexView

View file

@ -0,0 +1,5 @@
from django.views.generic import DetailView
from blog.models import Article
class ArticleDetail(DetailView):
model = Article

View file

@ -0,0 +1,11 @@
from django.views.generic import ListView
from blog.models import Article
class ArticleList(ListView):
preview = False
def get_queryset(self):
status = 1
if self.preview:
status = 0
return Article.objects.filter(status=status)

View file

@ -0,0 +1,60 @@
from django.views.generic import View
from django.http.response import HttpResponse
import shutil
import requests
import json
def save_image(post):
res = requests.get(post['media'], stream = True)
file_name = "/var/www/sciodog.fr/blog/static/blog/posts/" + post['url'].split('/')[-1]
try:
if res.status_code == 200:
with open(file_name,'wb') as f:
shutil.copyfileobj(res.raw, f)
post['media'] = "https://sciodog.fr/static/blog/posts/" + post['url'].split('/')[-1]
except IsADirectoryError as e:
pass
class IndexView(View):
template_name = "blog/index.html"
def get(self, *args, **kwargs):
context = {}
access_token = 'EAAEiPRfMZCtsBO9WSI2FMTKXeZBOFXoZBtHBbtBVLeSJh4ZAqIZC9PasW0li3IbPsWXrsVYn1yxPnRmMP8ZCs0aPT64dRd9FHaw0px6C61YwbgZALgNLCYWqD7MeTZCIq09MGwz044B2FO2JiuLMl0r16tNzHwJN4fQ5puXJeL6TZAUvcgaoIOglU1OEN55cssvYZD'
params = {
'access_token': access_token
}
url = 'https://graph.facebook.com/v13.0/102786409210660/feed?fields=attachments,message,permalink_url&limit=10'
response = requests.get(url, params=params)
posts = []
if response.status_code == 200:
data = response.json()
for post in data['data']:
ok = True
temp = {}
if 'message' in post.keys():
temp['message'] = post['message']
else:
ok = False
if 'attachments' in post.keys():
try:
try:
temp['media'] = post['attachments']['data'][0]['media']['image']['src']
except:
temp['media'] = post['attachments']['data'][0]['media']['image']['src']
except:
ok = False
else:
ok = False
if 'permalink_url' in post.keys():
temp['url'] = post['permalink_url']
else:
ok = False
if ok:
posts.append(temp)
save_image(temp)
else:
return HttpResponse(status=300, content=response.text)
return HttpResponse(status=200, content=json.dumps(posts))

22
sciodog-app/app/manage.py Executable file
View file

@ -0,0 +1,22 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sciodog.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()

View file

@ -0,0 +1,4 @@
django==4.2.7
python-dotenv==1.0.0
requests
tzdata

View file

View file

@ -0,0 +1,16 @@
"""
ASGI config for sciodog project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sciodog.settings')
application = get_asgi_application()

View file

@ -0,0 +1,128 @@
"""
Django settings for sciodog project.
Generated by 'django-admin startproject' using Django 4.2.7.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.2/ref/settings/
"""
from pathlib import Path
import os
from dotenv import load_dotenv
load_dotenv()
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-^cysot^fcha7(@k!3u5zf1-!in_&k^1-j1i@0yqi+k+vpda@s5'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True #os.environ["DEBUG"] != None
ALLOWED_HOSTS = [os.environ["HOSTNAME"], "sciodog.fr"]
# Application definition
INSTALLED_APPS = [
'blog',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'sciodog.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'sciodog.wsgi.application'
# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# Password validation
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/4.2/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/
STATIC_URL = 'static/'
# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

View file

@ -0,0 +1,23 @@
"""
URL configuration for sciodog project.
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include("blog.urls")),
]

View file

@ -0,0 +1,16 @@
"""
WSGI config for sciodog project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sciodog.settings')
application = get_wsgi_application()

View file

@ -0,0 +1,5 @@
# test.py
def application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')])
return [b"Hello World"] # python3

View file

@ -0,0 +1,10 @@
[uwsgi]
chdir = /var/www/html
master = true
uid = uwsgi
logto = /var/log/uwsgi.log
http-socket = 0.0.0.0:$(PORT)
module = $(WSGI_FILE)
processes = 4
threads = 2
die-on-term = true