From a672606f7197bf8a9019eebbb632396f3f43195f Mon Sep 17 00:00:00 2001 From: floreal15 Date: Tue, 5 Nov 2024 10:41:08 +0100 Subject: [PATCH 1/2] feat(back): init default backend --- .gitignore | 142 ++++++++++++++++++++++++++++++++++++++++++++ README.md | 31 ++++++++++ requirements.txt | 4 ++ src/__init__.py | 0 src/api/__init__.py | 0 src/main.py | 7 +++ 6 files changed, 184 insertions(+) create mode 100644 .gitignore create mode 100644 requirements.txt create mode 100644 src/__init__.py create mode 100644 src/api/__init__.py create mode 100644 src/main.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b4e4552 --- /dev/null +++ b/.gitignore @@ -0,0 +1,142 @@ +config/config.yml +config/config.local.yml +config/google-credentials.json +.flaskenv +*.ztr-directory + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +#IDE +.idea/ + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.env_external +.venv +env/ +venv/ +ENV/ +cbna_env/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +.ztr-directory diff --git a/README.md b/README.md index 76c7977..1b14583 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,33 @@ # gtt-api Backend de l'outil de Gestion du Temps de Travail (GTT). + +Installation et utilisation + +⚠️ Attention, le projet fonctionne uniquement sous Python v3.x + +Pour installer ce projet : + +Cloner le projet dans votre "workspace" local : + + git clone https://github.com/cbn-alpin/gtt-api.git + +Se deplacer dans le dossier du projet cloné : + + cd gtt-api/ + +Créer un environnement virtuel : + + python -m venv cbna_env + +Activer l'environnement virtuel : + + ./cbna_env/bin/activate + +Installer les dépendances : + + pip install -r requirements.txt + + +Lancement du framwork Flask : + + FLASK_APP=src/main.py flask run diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..f722bd7 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +alembic==1.14.0 +Flask==3.0.3 +Flask-SQLAlchemy==3.1.1 +SQLAlchemy==2.0.36 diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/api/__init__.py b/src/api/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/main.py b/src/main.py new file mode 100644 index 0000000..1d27225 --- /dev/null +++ b/src/main.py @@ -0,0 +1,7 @@ +from flask import Flask + +app = Flask(__name__) + +@app.route("/") +def hello_cbna(): + return "

Hello, CBNA!

" From 03bc05cbb438d95a41160ecd83406e7f45bd0ca1 Mon Sep 17 00:00:00 2001 From: floreal15 Date: Tue, 5 Nov 2024 10:59:12 +0100 Subject: [PATCH 2/2] fix(back): allow to be launch from ide --- src/main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main.py b/src/main.py index 1d27225..f0f5478 100644 --- a/src/main.py +++ b/src/main.py @@ -5,3 +5,6 @@ @app.route("/") def hello_cbna(): return "

Hello, CBNA!

" + +if __name__ == '__main__': + app.run()