https://github.com/ezeparziale/flask-auth-google-template
:key: Flask app with Google Auth login
https://github.com/ezeparziale/flask-auth-google-template
bootstrap flask flask-login google-auth postgres pydantic-v2 sqlalchemy
Last synced: 3 months ago
JSON representation
:key: Flask app with Google Auth login
- Host: GitHub
- URL: https://github.com/ezeparziale/flask-auth-google-template
- Owner: ezeparziale
- Created: 2022-08-19T00:50:56.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-03-03T10:08:31.000Z (over 1 year ago)
- Last Synced: 2025-04-12T17:53:22.254Z (about 1 year ago)
- Topics: bootstrap, flask, flask-login, google-auth, postgres, pydantic-v2, sqlalchemy
- Language: Python
- Homepage:
- Size: 129 KB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# :key: Flask auth google template
Flask app with Google auth login and postgres db
## :floppy_disk: Installation
> [!IMPORTANT]
> Min Python version: 3.13
Clone this repo:
```bash
git clone https://github.com/ezeparziale/flask-auth-google-template
```
Create virtual environment:
```bash
python -m venv env
```
Activate environment:
- Windows:
```bash
. env/scripts/activate
```
- Mac/Linux:
```bash
. env/bin/activate
```
Upgrade pip:
```bash
python -m pip install --upgrade pip
```
Install requirements:
```bash
pip install -r requirements-dev.txt
```
Install pre-commit:
```bash
pre-commit install
```
## :wrench: Config
Create `.env` and `.env.db` files. Check the examples `.env.example` and `.env.db.example`
:globe_with_meridians: Google Auth credentials:
Create your app and obtain your `client_id` and `secret`:
```http
https://developers.google.com/workspace/guides/create-credentials
```
:construction: Before first run:
Run `docker-compose` :whale: to start the database server
```bash
docker compose -f "compose.yaml" up -d --build adminer db
```
and init the database with alembic:
```bash
alembic upgrade head
```
:key: How to create cert and key
For run the `option 2` or `option 3` you need a `cert.pem` and `key.pem`.
Create a self-signed certificate with openssl:
```bash
openssl req -x509 -newkey rsa:4096 -nodes -out cert.pem -keyout key.pem -days 365
```
## :runner: Run
### :1st_place_medal: Option 1
Run the database with docker and the app with flask using a cert adhoc.
- Database:
```bash
docker compose -f "compose.yaml" up -d --build adminer db
```
- Flask app:
```bash
flask --debug run --cert=adhoc
```
### :2nd_place_medal: Option 2
Run the database with docker and the app with flask using your certificate.
- Database:
```bash
docker compose -f "compose.yaml" up -d --build adminer db
```
- Flask app:
```bash
flask --debug run --cert=cert.pem --key=key.pem
```
### :3rd_place_medal: Option 3
Run the database and the flask app with docker. This option use a cert and key.
In this option Flask run over gunicorn.
- Database and flask app:
```bash
docker compose -f "compose.yaml" up -d --build
```
## :pushpin: Features
- [x] Google Auth login
- [x] Sign up new users
- [x] Bootstrap
- [x] Flask
- [x] Alembic
- [x] Docker
- [x] Docker compose