Clone the repository
git clone https://github.com/Datzu712/For_Life_S.A.git
Setup the environment variables
Rename the .flaskenv.example
file to .flaskenv
and set the values for the environment variables
FLASK_APP=wsgi
FLASK_DEBUG=True
FLASK_ENV=development
FLASK_RUN_PORT=8080
FLASK_RUN_HOST=0.0.0.0
MYSQL_URL=mysql+pymysql://admin:root@mysql:3306/uni
MYSQL_USERNAME=admin MYSQL_PASSWORD=root MYSQL_HOST=mysql MYSQL_PORT=3306 # redirect port of docker, mysql inside docker always would be 3306 MYSQL_DATABASE=uni
REDIS_URL=redis://admin:root@redis:6379/0
REDIS_USERNAME=admin REDIS_PASSWORD=root REDIS_PORT=6379
SECRET_KEY=secret # secret key for the JWT token and flask sessions (we recommend to use different secrets for both)
SMTP_SERVER=smtp.example.com SMTP_PORT=587 SMTP_USERNAME=your_username SMTP_PASSWORD=password_token # you must use a token instead of your password SMTP_FROM_EMAIL=your_email@example.com SMTP_TO_EMAIL=recipient@example.com
APP_URL=http://localhost:5000
SENTRY_DSN=your_sentry_dsn
### Local setup (Keep in mind that you need to have MySQL and Redis installed)
3. Create a virtual environment
```bash
python3 -m venv .venv
source .venv/bin/activate
4.1 Activate the virtual environment (Windows)
.venv\Scripts\activate
Install the dependencies
pip install -r requirements.txt
Run the application
flask run
Generate the certificates for the Nginx server
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout nginx/ssl/cert.key -out nginx/ssl/cert.crt
Run the docker compose command
docker compose --env-file .flaskenv up
Access the application on https://localhost:443
To stop the application run
docker compose --env-file .flaskenv down
The application is built with webpack and typescript, to compile the files run the following command
# production build
npm run build:prod
# development build
npm run build:dev
# watch mode
npm run watch
I recommend to see the webpack.config.mjs
file to see how the files are compiled and how entry points are defined (because it's like a custom configuration). Probably you should change the way that entries are loaded, it's up to you.