- python3
- docker
- create a file in root directory (flask_mongo_docker/) with name: ".env"
$touch .env
- add the following keys to the ".env" file
JWT_SECRET_KEY='jwt_secret_key' host ='0.0.0.0' port='5000'
- build docker:
$ docker-compose build
- run docker
$ docker-compose up
- Install mongodb
- open terminal and run it:
$ mongod
-
create a python virtual environment in the root directory (same level as docker-compose file)
python -m venv <virtual_env_name> eg: $ python -m venv flask_env
-
activate the virtual environment
eg: $ . flask_env/bin/activate
NOTE: mind the space between . (dot) and flask_env (env name) (you can see the virtual env name at the beginning of the shell)
-
install python dependencies in your env.
eg: $ pip install -r requirement.txt
-
define 3 environment variables t):
$ export ENV_FILE_LOCATION=$(pwd)'/.env' $ export MONGODB_HOST='localhost' $ export MONGODB_NAME='flask_app'
-
Now you can run the flask app:
$ cd flask_app $ python app.py
-
-
endpoint:
localhost:5000/api/auth/signup
-
body:
{ "email": , "password": , "first_name": , "last_name": }
-
-
- endpoint:
localhost:5000/api/auth/loginbody:
- body:
{ "email": , "password": , }
-
-
endpoint:
localhost:5000/api/auth/refresh
-
authorization:
bearer token: refresh_token
-
-
-
endpoint:
localhost:5000/api/auth/logout_access
-
authorization:
bearer token: access_token
-
-
-
endpoint:
localhost:5000/api/auth/logout_refresh
-
authorization:
bearer token: refresh_token
-