From b35e4f4122a1127a74f958cc664846ede72a299a Mon Sep 17 00:00:00 2001 From: Yann Date: Mon, 6 Apr 2020 11:22:59 +0200 Subject: [PATCH] Premier commit --- bookpfe/__init__.py | 0 bookpfe/__pycache__/__init__.cpython-37.pyc | Bin 0 -> 132 bytes bookpfe/__pycache__/settings.cpython-37.pyc | Bin 0 -> 2252 bytes bookpfe/__pycache__/urls.cpython-37.pyc | Bin 0 -> 967 bytes bookpfe/__pycache__/wsgi.cpython-37.pyc | Bin 0 -> 535 bytes bookpfe/asgi.py | 16 +++ bookpfe/settings.py | 121 ++++++++++++++++++ bookpfe/urls.py | 22 ++++ bookpfe/wsgi.py | 16 +++ db.sqlite3 | 0 manage.py | 21 +++ recherche/__init__.py | 0 recherche/__pycache__/__init__.cpython-37.pyc | Bin 0 -> 134 bytes recherche/__pycache__/admin.cpython-37.pyc | Bin 0 -> 175 bytes recherche/__pycache__/models.cpython-37.pyc | Bin 0 -> 172 bytes recherche/__pycache__/urls.cpython-37.pyc | Bin 0 -> 263 bytes recherche/__pycache__/views.cpython-37.pyc | Bin 0 -> 514 bytes recherche/admin.py | 3 + recherche/apps.py | 5 + recherche/migrations/__init__.py | 0 .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 145 bytes recherche/models.py | 3 + recherche/templates/recherche/index.html | 24 ++++ recherche/tests.py | 3 + recherche/urls.py | 8 ++ recherche/views.py | 13 ++ 26 files changed, 255 insertions(+) create mode 100644 bookpfe/__init__.py create mode 100644 bookpfe/__pycache__/__init__.cpython-37.pyc create mode 100644 bookpfe/__pycache__/settings.cpython-37.pyc create mode 100644 bookpfe/__pycache__/urls.cpython-37.pyc create mode 100644 bookpfe/__pycache__/wsgi.cpython-37.pyc create mode 100644 bookpfe/asgi.py create mode 100644 bookpfe/settings.py create mode 100644 bookpfe/urls.py create mode 100644 bookpfe/wsgi.py create mode 100644 db.sqlite3 create mode 100755 manage.py create mode 100644 recherche/__init__.py create mode 100644 recherche/__pycache__/__init__.cpython-37.pyc create mode 100644 recherche/__pycache__/admin.cpython-37.pyc create mode 100644 recherche/__pycache__/models.cpython-37.pyc create mode 100644 recherche/__pycache__/urls.cpython-37.pyc create mode 100644 recherche/__pycache__/views.cpython-37.pyc create mode 100644 recherche/admin.py create mode 100644 recherche/apps.py create mode 100644 recherche/migrations/__init__.py create mode 100644 recherche/migrations/__pycache__/__init__.cpython-37.pyc create mode 100644 recherche/models.py create mode 100644 recherche/templates/recherche/index.html create mode 100644 recherche/tests.py create mode 100644 recherche/urls.py create mode 100644 recherche/views.py diff --git a/bookpfe/__init__.py b/bookpfe/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/bookpfe/__pycache__/__init__.cpython-37.pyc b/bookpfe/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..617148b57c9e3203dad6e3a7fd8c16897cf218ef GIT binary patch literal 132 zcmZ?b<>g`k0^Ju~aUl9Jh=2h`Aj1KOi&=m~3PUi1CZpd&gDC2&t<(iKVQw^^VdJWzFC>e<^D`R z#!m$|&vCLpaDkkWgFFiB%voAM)uiN>DV)AQ+W?&X|Q6C_x!2Fbh>U z*Do7Yn1gv(fb(zxF2W_GoP*2894z*8Aix#43fEu>KI;oK57*xd{k$;`H;e_i37==y z&XW>+@u2{>-WO=zxBw#DMoAIA%+}>>U7`8DU|fW+j7xCGxQxCm;=F?MD%>@$K|#x{ z-m@O&bGd4L-}3st$Oz}u>oc+Ehho?F-v&J*2BE)CY%W!+Tf`%w#R-VrBk?X|I%^iV z)Ds!ELOznbD@F`a#1ZI*^hkP)+Ak2(^+O_358+*lQ{NNu#|IP*QinW5`=mPHJYe6; zGWa%=hBn3?*uEcznp$zw@m(>vx{qfAEe1HxELavyJ8GcK0COUk;*` zJ9Kr!Tz;Y(vmvnuB*Ymn4v!|;zQ;q_m9j9#m#3)_AH+ANh^Y$kI6n#qi?2;F8DR_q zdz#@Q!|J2P^=S=`sj$-ouy}36b18sB4y}+#jMz~~`H`fJHmze`{LM7f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qwFe}A z1wHl`Rq~Y!`~^;UlNNO(&xc3z-t+kV&Q40A?fw4o<$FTNueNxwZcN_B4XfnukO;%li`RJXi8PF5-mGN{MwYj z8jA}ke3qso&){2w4jl7yV4DGXn`pc3F~!(p^4ziu~KPx$s9mB_r7tjIG0$sOfH0}@Ih07H3!2FvVA_s zOOISaqj6P(@%++Nil=|#I>>mCgy$9byuHgG$p|kFkKc`lr}^aQ>})h1PV$q}!%rWN zu6FNVpE>YenaT}%p_k`TLY@bTF6?fEWJT1UwXl{(qR<1gR2EH0ls=>X0Bj$p5&!@I literal 0 HcmV?d00001 diff --git a/bookpfe/asgi.py b/bookpfe/asgi.py new file mode 100644 index 0000000..a00e777 --- /dev/null +++ b/bookpfe/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for bookpfe 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/3.0/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'bookpfe.settings') + +application = get_asgi_application() diff --git a/bookpfe/settings.py b/bookpfe/settings.py new file mode 100644 index 0000000..f38d794 --- /dev/null +++ b/bookpfe/settings.py @@ -0,0 +1,121 @@ +""" +Django settings for bookpfe project. + +Generated by 'django-admin startproject' using Django 3.0.5. + +For more information on this file, see +https://docs.djangoproject.com/en/3.0/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/3.0/ref/settings/ +""" + +import os + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = '^hg5$z7q5wt19oa^1&6*+vidt_qrcts3#u!bqzj#pu$&i)3_#6' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'recherche', + '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 = 'bookpfe.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 = 'bookpfe.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/3.0/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + + +# Password validation +# https://docs.djangoproject.com/en/3.0/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/3.0/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/3.0/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/bookpfe/urls.py b/bookpfe/urls.py new file mode 100644 index 0000000..b75d639 --- /dev/null +++ b/bookpfe/urls.py @@ -0,0 +1,22 @@ +"""bookpfe URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/3.0/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 include, path + +urlpatterns = [ + path('recherche/', include('recherche.urls')), + path('admin/', admin.site.urls), +] diff --git a/bookpfe/wsgi.py b/bookpfe/wsgi.py new file mode 100644 index 0000000..0b284df --- /dev/null +++ b/bookpfe/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for bookpfe 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/3.0/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'bookpfe.settings') + +application = get_wsgi_application() diff --git a/db.sqlite3 b/db.sqlite3 new file mode 100644 index 0000000..e69de29 diff --git a/manage.py b/manage.py new file mode 100755 index 0000000..4183f0e --- /dev/null +++ b/manage.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'bookpfe.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() diff --git a/recherche/__init__.py b/recherche/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/recherche/__pycache__/__init__.cpython-37.pyc b/recherche/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..93175ec4d6201e0b8826538634657ea33d7ba6f4 GIT binary patch literal 134 zcmZ?b<>g`k0^b*1aUl9Jh=2h`Aj1KOi&=m~3PUi1CZpd&ryk0@&Ee@O9{FKt1R6CGCpMjVG E0CpW7`Tzg` literal 0 HcmV?d00001 diff --git a/recherche/__pycache__/admin.cpython-37.pyc b/recherche/__pycache__/admin.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..eb5a2f82c26380dc04055938273ffe930d7c2155 GIT binary patch literal 175 zcmZ?b<>g`k0^b*1arQv^F^B^LOhASM5Elyoi4=wu#vF!R#wbQch7_h?22JLdKv4!w z##^k3DY=<>ews{Cd?{IpdFlCj$@zIDMVU!OAOlu16fpxSF!4)AKO;XkRX;7YsM1)! vD77HJSU)L0Kf53;7064@NG$?leXwzQ1(mlrY;yBcN^?@}7=Z?S24V&P@y04d literal 0 HcmV?d00001 diff --git a/recherche/__pycache__/models.cpython-37.pyc b/recherche/__pycache__/models.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7ba12f4704ad5de2acae774a3eadcea804dda25b GIT binary patch literal 172 zcmZ?b<>g`k0^b*1ah5>(F^B^LOhASM5Elyoi4=wu#vF!R#wbQch7_h?22JLdKv4!w z##?N;`6;P6#eSMhw>VR>67$mY^-_|GK$=%F6tMs)F!4)QKO;XkRX;7YsM1)!D77HJ qSU)L0Kf53;7064@NG$?leTY$d1(mlrY=G?2oK!nTpb4LWm;nHOCn<;k literal 0 HcmV?d00001 diff --git a/recherche/__pycache__/urls.cpython-37.pyc b/recherche/__pycache__/urls.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9d03d8e8f34cd409b2ef9dfb6b8cf6726a30ab59 GIT binary patch literal 263 zcmXv|K~BR!479V^w4&`pBBbo0*9svXz=c~5NCCS|+iW)4ZE5=jBn~`-FYT36zQ74D zsFr5zk?pY`7K`gZ6#^sWtadqRDn8T( zYfY0UD5sB>4fc6^sU K3dwz*&DAeSy+FtS literal 0 HcmV?d00001 diff --git a/recherche/__pycache__/views.cpython-37.pyc b/recherche/__pycache__/views.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9bf5a5e9c8abd39dd1f5d78732b11f22977893af GIT binary patch literal 514 zcmYjNJx{|h5cNkssx}n}@h2jo28k6R1QKEb1WXw~CB8O=Bo4L<6qN}kenmU-5BM!! znV8v_xL9q)N%!=8cYgQmgKoD?Fg}0YuPRE&S94efL$Z&lw-E#pv>+u-DQ!3_SjkiF zI4``?PkrQ`@ZU%ph~R?6;WyqQF|~n$N`OKZ9UD`hgRW(zq3IN|kDUw`yWogE<{_ru zLNH`T1)b9uD%h0VvKbdl@HrdN7iPREo%vI&&)F-*h2F{Yrh+U-!5oqi?tJRyrYzDm z15XC7SG}V+P#&t=Xb9%oKv@@k1J*k`y|}a-YpOA#n&-#dh6?V-pp9*Q9(AvtSl?M|;YA%F5ZY!NOm&f+#9_KF zZu`|x_H-_l$;L)IAGWh7=lFxpo?Tm1mag2BoQyN|4A_k7&gI E0NE3Q$^ZZW literal 0 HcmV?d00001 diff --git a/recherche/admin.py b/recherche/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/recherche/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/recherche/apps.py b/recherche/apps.py new file mode 100644 index 0000000..fcfed28 --- /dev/null +++ b/recherche/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class RechercheConfig(AppConfig): + name = 'recherche' diff --git a/recherche/migrations/__init__.py b/recherche/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/recherche/migrations/__pycache__/__init__.cpython-37.pyc b/recherche/migrations/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f3aa57096c092f33094e07478a73baa83ac432e8 GIT binary patch literal 145 zcmZ?b<>g`k0^b*1aUl9Jh=2h`Aj1KOi&=m~3PUi1CZpd5ftUdR3Ogfl literal 0 HcmV?d00001 diff --git a/recherche/models.py b/recherche/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/recherche/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/recherche/templates/recherche/index.html b/recherche/templates/recherche/index.html new file mode 100644 index 0000000..72d1332 --- /dev/null +++ b/recherche/templates/recherche/index.html @@ -0,0 +1,24 @@ + + + + + Book PFE + + +

Formulaire de recherche

+ + {% if error_message %}

{{ error_message }}

{% endif %} + +
+ {% csrf_token %} + + +
+ + {% if texte_recherche %} +

Texte recherché

+

{{ texte_recherche }}

+ {% endif %} + + + diff --git a/recherche/tests.py b/recherche/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/recherche/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/recherche/urls.py b/recherche/urls.py new file mode 100644 index 0000000..4c9189f --- /dev/null +++ b/recherche/urls.py @@ -0,0 +1,8 @@ +from django.urls import path + +from . import views + +urlpatterns = [ + path('', views.index, name='index'), +] + diff --git a/recherche/views.py b/recherche/views.py new file mode 100644 index 0000000..41c509e --- /dev/null +++ b/recherche/views.py @@ -0,0 +1,13 @@ +from django.shortcuts import render + +# Create your views here. +from django.http import HttpResponse +from django.template import loader + + +def index(request): + template = loader.get_template('recherche/index.html') + context = { + 'texte_recherche': request.POST.get('texte_recherche',False), + } + return HttpResponse(template.render(context,request))