diff --git a/Dockerfile b/Dockerfile index e936fe3..2987276 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ -FROM node:latest -WORKDIR /app-frontend -COPY ["package.json", "package-lock.json*", "./"] -RUN npm install -RUN npm install -g @angular/cli -COPY . . +FROM python:latest +WORKDIR /data/backend +COPY requirements.txt requirements.txt +RUN pip install --upgrade pip +RUN pip install -r requirements.txt +COPY . . \ No newline at end of file diff --git a/backend/application/__init__.py b/__init__.py similarity index 56% rename from backend/application/__init__.py rename to __init__.py index b68cd09..ce09789 100644 --- a/backend/application/__init__.py +++ b/__init__.py @@ -1,16 +1,12 @@ from flask import Flask -from flask_sqlalchemy import SQLAlchemy from flask_cors import CORS -import sys - -db = SQLAlchemy() def create_app(flask_env='development'): - app = Flask(__name__, instance_relative_config=False) + app = Flask(__name__, instance_relative_config=False, static_url_path='') origin = app.config.get('ALLOW_ORIGIN') if origin is None: - origin = ['http://127.0.0.1:4200', 'http://localhost:4200'] + origin = ['http://127.0.0.1:5000', 'http://localhost:5000'] CORS(app, supports_credentials=True, origins=origin) if flask_env == 'production': app.config.from_object("config.ProductionConfig") @@ -21,15 +17,7 @@ def create_app(flask_env='development'): else: app.config.from_object("config.Config") - if app.config['SQLALCHEMY_DATABASE_URI_1'] is None or app.config['SQLALCHEMY_DATABASE_URI_2'] is None: - print('No ENV Variable for DATABASE_URL_USERS or DATABASE_URL_LOGS') - sys.exit(1) - else: - print('ENV Variables passed : ', app.config['SQLALCHEMY_BINDS']) - - db.init_app(app) with app.app_context(): from . import routes app.register_blueprint(routes.bp) - db.create_all() return app diff --git a/app.py b/app.py new file mode 100644 index 0000000..2faec63 --- /dev/null +++ b/app.py @@ -0,0 +1,7 @@ +from . import create_app +import os + +app = create_app(os.environ.get('FLASK_ENV', None)) + +if __name__ == "__main__": + app.run(host='0.0.0.0', DEBUG=True) diff --git a/backend/Dockerfile b/backend/Dockerfile deleted file mode 100644 index 2987276..0000000 --- a/backend/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM python:latest -WORKDIR /data/backend -COPY requirements.txt requirements.txt -RUN pip install --upgrade pip -RUN pip install -r requirements.txt -COPY . . \ No newline at end of file diff --git a/backend/app.py b/backend/app.py deleted file mode 100644 index 50e795c..0000000 --- a/backend/app.py +++ /dev/null @@ -1,8 +0,0 @@ -from application import create_app -import os - -app = create_app(os.environ.get('FLASK_ENV', None)) - -if __name__ == "__main__": - PORT = os.environ.get('PORT', 33507) - app.run(host='0.0.0.0', port=PORT, DEBUG=True) diff --git a/backend/requirements.txt b/backend/requirements.txt deleted file mode 100644 index 6317cbe..0000000 --- a/backend/requirements.txt +++ /dev/null @@ -1,13 +0,0 @@ -alembic==1.7.5 -Flask==2.0.2 -Flask-Migrate==3.1.0 -Flask-Script==2.0.6 -Flask-Testing==0.8.1 -Flask-SQLAlchemy==2.5.1 -Flask-WTF==0.15.1 -pipreqs==0.4.10 -PyJWT==2.3.0 -pytest==6.2.5 -SQLAlchemy==1.4.27 -psycopg2==2.9.2 -Flask-Cors==3.0.10 \ No newline at end of file diff --git a/backend/config.py b/config.py similarity index 92% rename from backend/config.py rename to config.py index 7bd3251..c689319 100644 --- a/backend/config.py +++ b/config.py @@ -10,6 +10,7 @@ class Config(object): FLASK_APP = os.environ.get('FLASK_APP', None) FLASK_ENV = os.environ.get('FLASK_ENV', None) + FLASK_RUN_PORT = os.environ.get('FLASK_RUN_PORT', 4200) API_URL = os.environ.get('API_URL', 'http://127.0.0.1:5000/api/') diff --git a/.browserslistrc b/frontend/.browserslistrc similarity index 94% rename from .browserslistrc rename to frontend/.browserslistrc index 427441d..8651e3c 100644 --- a/.browserslistrc +++ b/frontend/.browserslistrc @@ -15,3 +15,5 @@ last 2 Safari major versions last 2 iOS major versions Firefox ESR not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. +not ios_saf 15.2-15.3 +not safari 15.2-15.3 diff --git a/.editorconfig b/frontend/.editorconfig similarity index 100% rename from .editorconfig rename to frontend/.editorconfig diff --git a/.gitignore b/frontend/.gitignore similarity index 100% rename from .gitignore rename to frontend/.gitignore diff --git a/frontend/Dockerfile b/frontend/Dockerfile new file mode 100644 index 0000000..e936fe3 --- /dev/null +++ b/frontend/Dockerfile @@ -0,0 +1,6 @@ +FROM node:latest +WORKDIR /app-frontend +COPY ["package.json", "package-lock.json*", "./"] +RUN npm install +RUN npm install -g @angular/cli +COPY . . diff --git a/README.md b/frontend/README.md similarity index 100% rename from README.md rename to frontend/README.md diff --git a/angular.json b/frontend/angular.json similarity index 98% rename from angular.json rename to frontend/angular.json index a21c621..6dd4c96 100644 --- a/angular.json +++ b/frontend/angular.json @@ -20,7 +20,7 @@ "build": { "builder": "@angular-devkit/build-angular:browser", "options": { - "outputPath": "backend/static", + "outputPath": "dist/", "index": "src/index.html", "main": "src/main.ts", "polyfills": "src/polyfills.ts", diff --git a/conf/nginx.conf b/frontend/conf/nginx.conf similarity index 100% rename from conf/nginx.conf rename to frontend/conf/nginx.conf diff --git a/karma.conf.js b/frontend/karma.conf.js similarity index 100% rename from karma.conf.js rename to frontend/karma.conf.js diff --git a/logs/nginx/access.log b/frontend/logs/nginx/access.log similarity index 100% rename from logs/nginx/access.log rename to frontend/logs/nginx/access.log diff --git a/package.json b/frontend/package.json similarity index 87% rename from package.json rename to frontend/package.json index 5d8ce6c..d95a55b 100644 --- a/package.json +++ b/frontend/package.json @@ -3,8 +3,8 @@ "version": "0.0.0", "scripts": { "ng": "ng", - "start": "ng build --prod --build-optimizer --baseHref=”/static/” && node server.js", - "build": "ng build --prod --build-optimizer --baseHref=”/static/”", + "start": "ng build && python flask run", + "build": "ng build --build-optimizer --baseHref=frontend/dist", "watch": "ng build --watch --configuration development", "test": "ng test" }, diff --git a/src/app/admin/myProfil/commentary.txt b/frontend/src/app/admin/myProfil/commentary.txt similarity index 100% rename from src/app/admin/myProfil/commentary.txt rename to frontend/src/app/admin/myProfil/commentary.txt diff --git a/src/app/admin/userList/page-user-list/page-user-list.component.html b/frontend/src/app/admin/userList/page-user-list/page-user-list.component.html similarity index 100% rename from src/app/admin/userList/page-user-list/page-user-list.component.html rename to frontend/src/app/admin/userList/page-user-list/page-user-list.component.html diff --git a/src/app/admin/userList/page-user-list/page-user-list.component.scss b/frontend/src/app/admin/userList/page-user-list/page-user-list.component.scss similarity index 100% rename from src/app/admin/userList/page-user-list/page-user-list.component.scss rename to frontend/src/app/admin/userList/page-user-list/page-user-list.component.scss diff --git a/src/app/admin/userList/page-user-list/page-user-list.component.spec.ts b/frontend/src/app/admin/userList/page-user-list/page-user-list.component.spec.ts similarity index 100% rename from src/app/admin/userList/page-user-list/page-user-list.component.spec.ts rename to frontend/src/app/admin/userList/page-user-list/page-user-list.component.spec.ts diff --git a/src/app/admin/userList/page-user-list/page-user-list.component.ts b/frontend/src/app/admin/userList/page-user-list/page-user-list.component.ts similarity index 100% rename from src/app/admin/userList/page-user-list/page-user-list.component.ts rename to frontend/src/app/admin/userList/page-user-list/page-user-list.component.ts diff --git a/src/app/admin/userList/popup-create-person/popup-create-person.component.html b/frontend/src/app/admin/userList/popup-create-person/popup-create-person.component.html similarity index 100% rename from src/app/admin/userList/popup-create-person/popup-create-person.component.html rename to frontend/src/app/admin/userList/popup-create-person/popup-create-person.component.html diff --git a/src/app/admin/userList/popup-create-person/popup-create-person.component.scss b/frontend/src/app/admin/userList/popup-create-person/popup-create-person.component.scss similarity index 100% rename from src/app/admin/userList/popup-create-person/popup-create-person.component.scss rename to frontend/src/app/admin/userList/popup-create-person/popup-create-person.component.scss diff --git a/src/app/admin/userList/popup-create-person/popup-create-person.component.spec.ts b/frontend/src/app/admin/userList/popup-create-person/popup-create-person.component.spec.ts similarity index 100% rename from src/app/admin/userList/popup-create-person/popup-create-person.component.spec.ts rename to frontend/src/app/admin/userList/popup-create-person/popup-create-person.component.spec.ts diff --git a/src/app/admin/userList/popup-create-person/popup-create-person.component.ts b/frontend/src/app/admin/userList/popup-create-person/popup-create-person.component.ts similarity index 100% rename from src/app/admin/userList/popup-create-person/popup-create-person.component.ts rename to frontend/src/app/admin/userList/popup-create-person/popup-create-person.component.ts diff --git a/src/app/admin/userList/popup-update-person-admin/popup-update-person-admin.component.html b/frontend/src/app/admin/userList/popup-update-person-admin/popup-update-person-admin.component.html similarity index 100% rename from src/app/admin/userList/popup-update-person-admin/popup-update-person-admin.component.html rename to frontend/src/app/admin/userList/popup-update-person-admin/popup-update-person-admin.component.html diff --git a/src/app/admin/userList/popup-update-person-admin/popup-update-person-admin.component.scss b/frontend/src/app/admin/userList/popup-update-person-admin/popup-update-person-admin.component.scss similarity index 100% rename from src/app/admin/userList/popup-update-person-admin/popup-update-person-admin.component.scss rename to frontend/src/app/admin/userList/popup-update-person-admin/popup-update-person-admin.component.scss diff --git a/src/app/admin/userList/popup-update-person-admin/popup-update-person-admin.component.spec.ts b/frontend/src/app/admin/userList/popup-update-person-admin/popup-update-person-admin.component.spec.ts similarity index 100% rename from src/app/admin/userList/popup-update-person-admin/popup-update-person-admin.component.spec.ts rename to frontend/src/app/admin/userList/popup-update-person-admin/popup-update-person-admin.component.spec.ts diff --git a/src/app/admin/userList/popup-update-person-admin/popup-update-person-admin.component.ts b/frontend/src/app/admin/userList/popup-update-person-admin/popup-update-person-admin.component.ts similarity index 100% rename from src/app/admin/userList/popup-update-person-admin/popup-update-person-admin.component.ts rename to frontend/src/app/admin/userList/popup-update-person-admin/popup-update-person-admin.component.ts diff --git a/src/app/app-routing.module.ts b/frontend/src/app/app-routing.module.ts similarity index 100% rename from src/app/app-routing.module.ts rename to frontend/src/app/app-routing.module.ts diff --git a/src/app/app.component.html b/frontend/src/app/app.component.html similarity index 100% rename from src/app/app.component.html rename to frontend/src/app/app.component.html diff --git a/src/app/app.component.scss b/frontend/src/app/app.component.scss similarity index 100% rename from src/app/app.component.scss rename to frontend/src/app/app.component.scss diff --git a/src/app/app.component.spec.ts b/frontend/src/app/app.component.spec.ts similarity index 100% rename from src/app/app.component.spec.ts rename to frontend/src/app/app.component.spec.ts diff --git a/src/app/app.component.ts b/frontend/src/app/app.component.ts similarity index 100% rename from src/app/app.component.ts rename to frontend/src/app/app.component.ts diff --git a/src/app/app.module.ts b/frontend/src/app/app.module.ts similarity index 100% rename from src/app/app.module.ts rename to frontend/src/app/app.module.ts diff --git a/src/app/common/components/navbar/navbar.component.html b/frontend/src/app/common/components/navbar/navbar.component.html similarity index 100% rename from src/app/common/components/navbar/navbar.component.html rename to frontend/src/app/common/components/navbar/navbar.component.html diff --git a/src/app/common/components/navbar/navbar.component.scss b/frontend/src/app/common/components/navbar/navbar.component.scss similarity index 100% rename from src/app/common/components/navbar/navbar.component.scss rename to frontend/src/app/common/components/navbar/navbar.component.scss diff --git a/src/app/common/components/navbar/navbar.component.spec.ts b/frontend/src/app/common/components/navbar/navbar.component.spec.ts similarity index 100% rename from src/app/common/components/navbar/navbar.component.spec.ts rename to frontend/src/app/common/components/navbar/navbar.component.spec.ts diff --git a/src/app/common/components/navbar/navbar.component.ts b/frontend/src/app/common/components/navbar/navbar.component.ts similarity index 100% rename from src/app/common/components/navbar/navbar.component.ts rename to frontend/src/app/common/components/navbar/navbar.component.ts diff --git a/src/app/common/components/page-profil/page-profil.component.html b/frontend/src/app/common/components/page-profil/page-profil.component.html similarity index 100% rename from src/app/common/components/page-profil/page-profil.component.html rename to frontend/src/app/common/components/page-profil/page-profil.component.html diff --git a/src/app/common/components/page-profil/page-profil.component.scss b/frontend/src/app/common/components/page-profil/page-profil.component.scss similarity index 100% rename from src/app/common/components/page-profil/page-profil.component.scss rename to frontend/src/app/common/components/page-profil/page-profil.component.scss diff --git a/src/app/common/components/page-profil/page-profil.component.spec.ts b/frontend/src/app/common/components/page-profil/page-profil.component.spec.ts similarity index 100% rename from src/app/common/components/page-profil/page-profil.component.spec.ts rename to frontend/src/app/common/components/page-profil/page-profil.component.spec.ts diff --git a/src/app/common/components/page-profil/page-profil.component.ts b/frontend/src/app/common/components/page-profil/page-profil.component.ts similarity index 100% rename from src/app/common/components/page-profil/page-profil.component.ts rename to frontend/src/app/common/components/page-profil/page-profil.component.ts diff --git a/src/app/common/components/popup-delete-profil/popup-delete-profil.component.html b/frontend/src/app/common/components/popup-delete-profil/popup-delete-profil.component.html similarity index 100% rename from src/app/common/components/popup-delete-profil/popup-delete-profil.component.html rename to frontend/src/app/common/components/popup-delete-profil/popup-delete-profil.component.html diff --git a/src/app/common/components/popup-delete-profil/popup-delete-profil.component.scss b/frontend/src/app/common/components/popup-delete-profil/popup-delete-profil.component.scss similarity index 100% rename from src/app/common/components/popup-delete-profil/popup-delete-profil.component.scss rename to frontend/src/app/common/components/popup-delete-profil/popup-delete-profil.component.scss diff --git a/src/app/common/components/popup-delete-profil/popup-delete-profil.component.spec.ts b/frontend/src/app/common/components/popup-delete-profil/popup-delete-profil.component.spec.ts similarity index 100% rename from src/app/common/components/popup-delete-profil/popup-delete-profil.component.spec.ts rename to frontend/src/app/common/components/popup-delete-profil/popup-delete-profil.component.spec.ts diff --git a/src/app/common/components/popup-delete-profil/popup-delete-profil.component.ts b/frontend/src/app/common/components/popup-delete-profil/popup-delete-profil.component.ts similarity index 100% rename from src/app/common/components/popup-delete-profil/popup-delete-profil.component.ts rename to frontend/src/app/common/components/popup-delete-profil/popup-delete-profil.component.ts diff --git a/src/app/common/components/popup-update-profil/popup-update-profil.component.html b/frontend/src/app/common/components/popup-update-profil/popup-update-profil.component.html similarity index 100% rename from src/app/common/components/popup-update-profil/popup-update-profil.component.html rename to frontend/src/app/common/components/popup-update-profil/popup-update-profil.component.html diff --git a/src/app/common/components/popup-update-profil/popup-update-profil.component.scss b/frontend/src/app/common/components/popup-update-profil/popup-update-profil.component.scss similarity index 100% rename from src/app/common/components/popup-update-profil/popup-update-profil.component.scss rename to frontend/src/app/common/components/popup-update-profil/popup-update-profil.component.scss diff --git a/src/app/common/components/popup-update-profil/popup-update-profil.component.spec.ts b/frontend/src/app/common/components/popup-update-profil/popup-update-profil.component.spec.ts similarity index 100% rename from src/app/common/components/popup-update-profil/popup-update-profil.component.spec.ts rename to frontend/src/app/common/components/popup-update-profil/popup-update-profil.component.spec.ts diff --git a/src/app/common/components/popup-update-profil/popup-update-profil.component.ts b/frontend/src/app/common/components/popup-update-profil/popup-update-profil.component.ts similarity index 100% rename from src/app/common/components/popup-update-profil/popup-update-profil.component.ts rename to frontend/src/app/common/components/popup-update-profil/popup-update-profil.component.ts diff --git a/src/app/common/guards/admin/admin.guard.spec.ts b/frontend/src/app/common/guards/admin/admin.guard.spec.ts similarity index 100% rename from src/app/common/guards/admin/admin.guard.spec.ts rename to frontend/src/app/common/guards/admin/admin.guard.spec.ts diff --git a/src/app/common/guards/admin/admin.guard.ts b/frontend/src/app/common/guards/admin/admin.guard.ts similarity index 100% rename from src/app/common/guards/admin/admin.guard.ts rename to frontend/src/app/common/guards/admin/admin.guard.ts diff --git a/src/app/common/guards/user/user.guard.spec.ts b/frontend/src/app/common/guards/user/user.guard.spec.ts similarity index 100% rename from src/app/common/guards/user/user.guard.spec.ts rename to frontend/src/app/common/guards/user/user.guard.spec.ts diff --git a/src/app/common/guards/user/user.guard.ts b/frontend/src/app/common/guards/user/user.guard.ts similarity index 100% rename from src/app/common/guards/user/user.guard.ts rename to frontend/src/app/common/guards/user/user.guard.ts diff --git a/src/app/common/services/checkEmail/check-email.service.spec.ts b/frontend/src/app/common/services/checkEmail/check-email.service.spec.ts similarity index 100% rename from src/app/common/services/checkEmail/check-email.service.spec.ts rename to frontend/src/app/common/services/checkEmail/check-email.service.spec.ts diff --git a/src/app/common/services/checkEmail/check-email.service.ts b/frontend/src/app/common/services/checkEmail/check-email.service.ts similarity index 100% rename from src/app/common/services/checkEmail/check-email.service.ts rename to frontend/src/app/common/services/checkEmail/check-email.service.ts diff --git a/src/app/common/services/fictitiousDatas/fictitious-datas.service.spec.ts b/frontend/src/app/common/services/fictitiousDatas/fictitious-datas.service.spec.ts similarity index 100% rename from src/app/common/services/fictitiousDatas/fictitious-datas.service.spec.ts rename to frontend/src/app/common/services/fictitiousDatas/fictitious-datas.service.spec.ts diff --git a/src/app/common/services/fictitiousDatas/fictitious-datas.service.ts b/frontend/src/app/common/services/fictitiousDatas/fictitious-datas.service.ts similarity index 100% rename from src/app/common/services/fictitiousDatas/fictitious-datas.service.ts rename to frontend/src/app/common/services/fictitiousDatas/fictitious-datas.service.ts diff --git a/src/app/common/services/hashage/hashage.service.spec.ts b/frontend/src/app/common/services/hashage/hashage.service.spec.ts similarity index 100% rename from src/app/common/services/hashage/hashage.service.spec.ts rename to frontend/src/app/common/services/hashage/hashage.service.spec.ts diff --git a/src/app/common/services/hashage/hashage.service.ts b/frontend/src/app/common/services/hashage/hashage.service.ts similarity index 100% rename from src/app/common/services/hashage/hashage.service.ts rename to frontend/src/app/common/services/hashage/hashage.service.ts diff --git a/src/app/common/services/message/message.service.spec.ts b/frontend/src/app/common/services/message/message.service.spec.ts similarity index 100% rename from src/app/common/services/message/message.service.spec.ts rename to frontend/src/app/common/services/message/message.service.spec.ts diff --git a/src/app/common/services/message/message.service.ts b/frontend/src/app/common/services/message/message.service.ts similarity index 100% rename from src/app/common/services/message/message.service.ts rename to frontend/src/app/common/services/message/message.service.ts diff --git a/src/app/common/services/profil/profil.service.spec.ts b/frontend/src/app/common/services/profil/profil.service.spec.ts similarity index 100% rename from src/app/common/services/profil/profil.service.spec.ts rename to frontend/src/app/common/services/profil/profil.service.spec.ts diff --git a/src/app/common/services/profil/profil.service.ts b/frontend/src/app/common/services/profil/profil.service.ts similarity index 100% rename from src/app/common/services/profil/profil.service.ts rename to frontend/src/app/common/services/profil/profil.service.ts diff --git a/src/app/login/page-login/page-login.component.html b/frontend/src/app/login/page-login/page-login.component.html similarity index 100% rename from src/app/login/page-login/page-login.component.html rename to frontend/src/app/login/page-login/page-login.component.html diff --git a/src/app/login/page-login/page-login.component.scss b/frontend/src/app/login/page-login/page-login.component.scss similarity index 100% rename from src/app/login/page-login/page-login.component.scss rename to frontend/src/app/login/page-login/page-login.component.scss diff --git a/src/app/login/page-login/page-login.component.spec.ts b/frontend/src/app/login/page-login/page-login.component.spec.ts similarity index 100% rename from src/app/login/page-login/page-login.component.spec.ts rename to frontend/src/app/login/page-login/page-login.component.spec.ts diff --git a/src/app/login/page-login/page-login.component.ts b/frontend/src/app/login/page-login/page-login.component.ts similarity index 100% rename from src/app/login/page-login/page-login.component.ts rename to frontend/src/app/login/page-login/page-login.component.ts diff --git a/src/app/register/page-register/page-register.component.html b/frontend/src/app/register/page-register/page-register.component.html similarity index 100% rename from src/app/register/page-register/page-register.component.html rename to frontend/src/app/register/page-register/page-register.component.html diff --git a/src/app/register/page-register/page-register.component.scss b/frontend/src/app/register/page-register/page-register.component.scss similarity index 100% rename from src/app/register/page-register/page-register.component.scss rename to frontend/src/app/register/page-register/page-register.component.scss diff --git a/src/app/register/page-register/page-register.component.spec.ts b/frontend/src/app/register/page-register/page-register.component.spec.ts similarity index 100% rename from src/app/register/page-register/page-register.component.spec.ts rename to frontend/src/app/register/page-register/page-register.component.spec.ts diff --git a/src/app/register/page-register/page-register.component.ts b/frontend/src/app/register/page-register/page-register.component.ts similarity index 100% rename from src/app/register/page-register/page-register.component.ts rename to frontend/src/app/register/page-register/page-register.component.ts diff --git a/src/app/register/popup-confirm-register/popup-confirm-register.component.html b/frontend/src/app/register/popup-confirm-register/popup-confirm-register.component.html similarity index 100% rename from src/app/register/popup-confirm-register/popup-confirm-register.component.html rename to frontend/src/app/register/popup-confirm-register/popup-confirm-register.component.html diff --git a/src/app/register/popup-confirm-register/popup-confirm-register.component.scss b/frontend/src/app/register/popup-confirm-register/popup-confirm-register.component.scss similarity index 100% rename from src/app/register/popup-confirm-register/popup-confirm-register.component.scss rename to frontend/src/app/register/popup-confirm-register/popup-confirm-register.component.scss diff --git a/src/app/register/popup-confirm-register/popup-confirm-register.component.spec.ts b/frontend/src/app/register/popup-confirm-register/popup-confirm-register.component.spec.ts similarity index 100% rename from src/app/register/popup-confirm-register/popup-confirm-register.component.spec.ts rename to frontend/src/app/register/popup-confirm-register/popup-confirm-register.component.spec.ts diff --git a/src/app/register/popup-confirm-register/popup-confirm-register.component.ts b/frontend/src/app/register/popup-confirm-register/popup-confirm-register.component.ts similarity index 100% rename from src/app/register/popup-confirm-register/popup-confirm-register.component.ts rename to frontend/src/app/register/popup-confirm-register/popup-confirm-register.component.ts diff --git a/src/app/user/myProfil/commentary.txt b/frontend/src/app/user/myProfil/commentary.txt similarity index 100% rename from src/app/user/myProfil/commentary.txt rename to frontend/src/app/user/myProfil/commentary.txt diff --git a/src/app/user/page-registry/page-registry.component.html b/frontend/src/app/user/page-registry/page-registry.component.html similarity index 100% rename from src/app/user/page-registry/page-registry.component.html rename to frontend/src/app/user/page-registry/page-registry.component.html diff --git a/src/app/user/page-registry/page-registry.component.scss b/frontend/src/app/user/page-registry/page-registry.component.scss similarity index 100% rename from src/app/user/page-registry/page-registry.component.scss rename to frontend/src/app/user/page-registry/page-registry.component.scss diff --git a/src/app/user/page-registry/page-registry.component.spec.ts b/frontend/src/app/user/page-registry/page-registry.component.spec.ts similarity index 100% rename from src/app/user/page-registry/page-registry.component.spec.ts rename to frontend/src/app/user/page-registry/page-registry.component.spec.ts diff --git a/src/app/user/page-registry/page-registry.component.ts b/frontend/src/app/user/page-registry/page-registry.component.ts similarity index 100% rename from src/app/user/page-registry/page-registry.component.ts rename to frontend/src/app/user/page-registry/page-registry.component.ts diff --git a/src/assets/.gitkeep b/frontend/src/assets/.gitkeep similarity index 100% rename from src/assets/.gitkeep rename to frontend/src/assets/.gitkeep diff --git a/src/assets/logo.png b/frontend/src/assets/logo.png similarity index 100% rename from src/assets/logo.png rename to frontend/src/assets/logo.png diff --git a/src/assets/logo1.png b/frontend/src/assets/logo1.png similarity index 100% rename from src/assets/logo1.png rename to frontend/src/assets/logo1.png diff --git a/src/environments/environment.prod.ts b/frontend/src/environments/environment.prod.ts similarity index 55% rename from src/environments/environment.prod.ts rename to frontend/src/environments/environment.prod.ts index b5bca68..dc660af 100644 --- a/src/environments/environment.prod.ts +++ b/frontend/src/environments/environment.prod.ts @@ -1,4 +1,4 @@ export const environment = { production: true, - debutUrl: 'http://127.0.0.1:5000/api/' + debutUrl: 'http://127.0.0.1:4200/api/' }; diff --git a/src/environments/environment.ts b/frontend/src/environments/environment.ts similarity index 93% rename from src/environments/environment.ts rename to frontend/src/environments/environment.ts index 0dfd866..ab9ef5a 100644 --- a/src/environments/environment.ts +++ b/frontend/src/environments/environment.ts @@ -5,7 +5,7 @@ export const environment = { production: false, - debutUrl: 'http://127.0.0.1:5000/api/' + debutUrl: 'http://127.0.0.1:4200/api/' }; /* diff --git a/src/favicon.ico b/frontend/src/favicon.ico similarity index 100% rename from src/favicon.ico rename to frontend/src/favicon.ico diff --git a/src/index.html b/frontend/src/index.html similarity index 100% rename from src/index.html rename to frontend/src/index.html diff --git a/src/main.ts b/frontend/src/main.ts similarity index 100% rename from src/main.ts rename to frontend/src/main.ts diff --git a/src/polyfills.ts b/frontend/src/polyfills.ts similarity index 100% rename from src/polyfills.ts rename to frontend/src/polyfills.ts diff --git a/src/styles.scss b/frontend/src/styles.scss similarity index 100% rename from src/styles.scss rename to frontend/src/styles.scss diff --git a/src/test.ts b/frontend/src/test.ts similarity index 100% rename from src/test.ts rename to frontend/src/test.ts diff --git a/tsconfig.app.json b/frontend/tsconfig.app.json similarity index 100% rename from tsconfig.app.json rename to frontend/tsconfig.app.json diff --git a/tsconfig.json b/frontend/tsconfig.json similarity index 100% rename from tsconfig.json rename to frontend/tsconfig.json diff --git a/tsconfig.spec.json b/frontend/tsconfig.spec.json similarity index 100% rename from tsconfig.spec.json rename to frontend/tsconfig.spec.json diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..1449498 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,7 @@ +Flask==2.0.2 +Flask-Testing==0.8.1 +Flask-WTF==0.15.1 +PyJWT==2.3.0 +pytest==6.2.5 +psycopg2==2.9.2 +Flask-Cors==3.0.10 diff --git a/backend/application/responses.py b/responses.py similarity index 100% rename from backend/application/responses.py rename to responses.py diff --git a/backend/application/routes.py b/routes.py similarity index 94% rename from backend/application/routes.py rename to routes.py index c101915..476d4fe 100644 --- a/backend/application/routes.py +++ b/routes.py @@ -1,28 +1,29 @@ -from flask import request, Blueprint, render_template, current_app as app +from flask import request, Blueprint, send_from_directory, current_app as app +import requests +import os from werkzeug.exceptions import HTTPException from .responses import send_message, send_error -import requests from .sessionJWT import create_auth_token, check_auth_token # Request Post def request_post(url, data_json): - return requests.post(app.config['SQLALCHEMY_BINDS'] + url, json=data_json) + return requests.post(app.config['API_URL'] + url, json=data_json) # Request Put def request_put(url, data_json): - return requests.put(app.config['SQLALCHEMY_BINDS'] + url, json=data_json) + return requests.put(app.config['API_URL'] + url, json=data_json) # Request Get def request_get(url): - return requests.get(app.config['SQLALCHEMY_BINDS'] + url) + return requests.get(app.config['API_URL'] + url) # Request Delete def request_delete(url, data_json): - return requests.delete(app.config['SQLALCHEMY_BINDS'] + url, json=data_json) + return requests.delete(app.config['API_URL'] + url, json=data_json) bp = Blueprint('myapp', __name__) @@ -35,7 +36,17 @@ def handle_exception(e): @bp.route('/', methods=['GET']) def root(): - return render_template('index.html') + return send_from_directory("frontend/dist", "index.html") + + +@bp.route('/frontend/dist/', methods=['GET']) +def static(path): + return send_from_directory("frontend/dist", path) + + +@bp.route('/assets/', methods=['GET']) +def assets(path): + return send_from_directory("frontend/dist/assets", path) # Login diff --git a/backend/application/sessionJWT.py b/sessionJWT.py similarity index 100% rename from backend/application/sessionJWT.py rename to sessionJWT.py