Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pur Beurre] Initial Commit #1

Merged
merged 1 commit into from Nov 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
33 changes: 33 additions & 0 deletions .coveragerc
@@ -0,0 +1,33 @@
[run]
omit =
# omit anything in a .local directory anywhere
*/venv/*
*/migrations/*
*/urls.py
*/settings.py
*/test_settings.py
*/__init__.py
# omit everything in /usr
./tests/*
# omit this single file
manage.py

[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover

# Don't complain about missing debug-only code:
def __repr__
if self\.debug

# Don't complain if non-runnable code isn't run:
if __name__ == .__main__.:


[html]
directory = coverage_html_report

[paths]
source = .
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions .idea/Pur_BeurreP11.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .travis.yml
@@ -0,0 +1,20 @@
language: python
python:
- '3.7'

before_script:
- pip install -r requirements.txt
- coverage erase

env: DJANGO_SETTINGS_MODULE="pur_beurre.settings.test_settings"

services:
- postgresql

script:
- coverage run ./manage.py test tests.apps --settings=pur_beurre.settings.test_settings

# safelist
branches:
only:
- staging
1 change: 1 addition & 0 deletions Procfile
@@ -0,0 +1 @@
web: gunicorn pur_beurre.wsgi --log-file -
67 changes: 67 additions & 0 deletions README.md
@@ -0,0 +1,67 @@
# PurBeurre_P10
Openclassrooms DA-Python P10 Pur Beurre:
Déployez votre application sur un serveur comme un pro

### Déploiement du P8 sur un serveur, intégration continue et monitoring

### projet déployé : http://165.22.199.87/

### Constraints
tests included in the project

use of PostgreSql to deploy the project with Heroku

include a page with "Mentions Légales"

PEP8 compliant

Github versioning

code written in english

agile methodology

### How to use this program

You can find this program deployed on Heroku : https://elwaze-purbeurre.herokuapp.com/

You can also fork this repository :
```bash
git clone "https://github.com/elwaze/PurBeurre_P8.git"
```

Use requirements.txt to install the program environment:
```bash
pip install -r requirements.txt
```

Setting environment variables
```bash
DATABASE_URL
ENV="PRODUCTION"
SECRET_KEY
```

Populating DB
```bash
python manage.py off_db
```

Running the program
```bash
python manage.py runserver
```

### Testing

#### Coverage

**Remove coverage_html_report folder** to ensure no previous generated files remains.

**.coveragerc** file has been created to finely tune the coverage behavior.

```bash
coverage erase
coverage run manage.py test tests.apps --settings=pur_beurre.settings.test_settings
coverage h
```
Empty file added __init__.py
Empty file.
Empty file added apps/__init__.py
Empty file.
Binary file added apps/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Empty file added apps/core/__init__.py
Empty file.
Binary file added apps/core/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file added apps/core/__pycache__/admin.cpython-38.pyc
Binary file not shown.
Binary file added apps/core/__pycache__/models.cpython-38.pyc
Binary file not shown.
Binary file added apps/core/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file added apps/core/__pycache__/views.cpython-38.pyc
Binary file not shown.
3 changes: 3 additions & 0 deletions apps/core/admin.py
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
5 changes: 5 additions & 0 deletions apps/core/apps.py
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class PurbeurreMainConfig(AppConfig):
name = 'apps.core'
Empty file.
Binary file not shown.
3 changes: 3 additions & 0 deletions apps/core/models.py
@@ -0,0 +1,3 @@
from django.db import models

# Create your models here.
100 changes: 100 additions & 0 deletions apps/core/templates/home.html
@@ -0,0 +1,100 @@
{% extends "base.html" %}
{% load static %}
<link rel="stylesheet" href="{% static 'css/home.css' %}">
{% block title %}Pur Beurre{% endblock %}

{% block content %}

<!-- Masthead-->
<header class="masthead">
<div class="container h-100">
<div class="row h-100 align-items-center justify-content-center text-center">
<div class="col-lg-10 align-self-end">
<h1 class="text-uppercase text-white font-weight-bold">
Du gras, oui, mais de qualité&nbsp;!
</h1>
</div>
<div class="col-lg-9 align-self-baseline">
<h2 class="text-white-75 font-weight-light mb-5">
Trouvez un produit de substitution pour ceux que vous consommez tous les jours.
</h2>
<form method="GET" action="{% url 'results' %}" >
<div class="row justify-content-center">
<input type="text" class="col-lg-6 form-control search" name="query" placeholder="Produit">
<button class="col-lg-2 btn btn-primary" type="submit" value="Chercher">Chercher</button>
</div>
</form>
</div>
</div>
</div>
</header>
<!-- About-->
<section class="page-section bg-primary" id="about">
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-8 text-center">
<h2 class="text-white mt-0">Colette et Remy</h2>
<hr class="divider light my-4" />
<h3 class="text-white mt-0">De la ratatouille aux croissants</h3>
<p class="text-white-50 mb-4">
Pur Beurre est l'initiative de deux amoureux de la gastronomie française, Colette Tatou et Rémy,
que vous avez déjà certainement rencontrés dans notre excellent restaurant Ratatouille.
</p>
<p class="text-white-50 mb-4">
<strong>Colette Tatou :</strong>
"Nous aimons tous manger, surtout en France ! Personnellement, une baguette fraîche,
du bon fromage de chèvre et un bon vin rouge me suffisent amplement. Comme tout le monde,
je fais mes courses au supermarché. Mais petit à petit je me suis rendue compte,
surtout lorsque nous avons ouvert le restaurant, que je pouvais remplacer les produits aseptisés
que j'avais l'habitude d'acheter par de bons produits du terroir Et souvent pour le même prix !"
</p>
<p class="text-white-50 mb-4">
<strong>Rémy :</strong>
"Pour ma part je me rendais déjà dans bien des magasins car j'aime beaucoup me balader,
surtout dans les caves et les cuisines. Je connaissais par coeur le contenu des boutiques bio
(dont je raffole) ainsi que les ingrédients de tous les aliments vendus. Lorsque Colette m'a demandé
si elle pouvait remplacer son Nutella matinal par un aliment plus sain,
je savais tout de suite où le trouver. L'idée de Pur Beurre était née !"
</p>
</div>
</div>
<div class="row">
<div class="col-lg-6 col-md-6 text-center">
<div class="mt-5">
<img class="about-picture" src="{% static 'img/colette-tatou-full.png' %}" alt="Colette" height="50%" width="50%">
<h3 class="h4 mb-2">Colette</h3>
</div>
</div>
<div class="col-lg-6 col-md-6 text-center">
<div class="mt-5">
<img class="about-picture" src="{% static 'img/ratatouille-portrait.jpg' %}" alt="Remy" height="600" width="300">
<h3 class="h4 mb-2">Remy</h3>
</div>
</div>
</div>
</div>
</section>
<!-- Contact-->
<section class="page-section" id="contact">
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-8 text-center">
<h2 class="mt-0">Contactez-nous !</h2>
<hr class="divider my-4" />
<p class="text-muted mb-5">Nous répondrons à vos questions ou à vos suggestions dans les plus brefs délais !</p>
</div>
</div>
<div class="row">
<div class="col-lg-4 ml-auto text-center mb-5 mb-lg-0">
<i class="fas fa-phone fa-3x mb-3 text-muted"></i>
<div>0000000000</div>
</div>
<div class="col-lg-4 mr-auto text-center">
<i class="fas fa-envelope fa-3x mb-3 text-muted"></i>
<a class="d-block" href="mailto:mail@yourwebsite.com">contact@mail.com</a>
</div>
</div>
</div>
</section>

{% endblock %}
52 changes: 52 additions & 0 deletions apps/core/templates/legal_notices.html
@@ -0,0 +1,52 @@
{% extends "base.html" %}
{% load static %}

{% block title %}Homepage{% endblock %}

{% block content %}

<section>
<div class="container h-100 col-lg-12" >
<div class="row h-100 align-items-center justify-content-center text-center bg-secondary">
<div class="col-lg-10 align-self-end" style="padding-top: 10rem;">
<h1 class="text-uppercase font-weight-bold">Mentions légales</h1>
<hr class="divider my-4">
</div>
<div class="col-lg-8 text-left text-50 mb-4" style=" padding-bottom: 10rem;">
<p>Site réalisé par
<a href="https://github.com/elwaze" title="GitHub">Eloïse Lamontagne</a>
pour <a href="https://company-82435.frontify.com/d/6Yy9WFJdtp8j/pur-beurre-style-guide" title="PurBeurre">
<strong>Pur Beurre</strong>
</a>
<br>
</p>
<p>Données et images produits :
<a href="https://fr.openfoodfacts.org/" title="OpenFoodFacts">OpenFoodFacts</a>
<br>
</p>
<p>Template Bootstrap :
<a href="https://startbootstrap.com/themes/creative/" title="Bootstrap">Start Bootstrap Creative</a>
<br>
</p>
<p> Site hébergé par
<a href="http://heroku.com" title="Heroku">Heroku</a>
<br>
</p>
<p> Image de fond : photo by Olenka Kotyk,
<a href="https://unsplash.com/photos/eqsEZNCm4-c" title="Unsplash">Unsplash</a>
<br>
</p>
<p> Icone carotte : Carrot by Fabien Jouin from
<a href="https://thenounproject.com/term/carrot/29691/" title="The Noun Project">The Noun Project</a>
<br>
</p>
<p> Autres icones :
<a href="https://fontawesome.com/icons?from=io" title="Font Awesome">Font Awesome</a>
<br>
</p>
</div>
</div>
</div>
</section>

{% endblock %}