-
Using docker compose
To start, you will have to build the docker image so usedocker-compose build.
To run the docker image, please usedocker-compose up.
To re-run, after making changes please usedocker-compose buildbeforedocker-compose up. -
Using dockerfile
In our parent directory, if you notice there is a Dockerfile as well. You can use this to build your image as well
docker build -t <tag> .
docker run -p 5000:5000 <tag>
To check all your docker images use:
docker ps
-
First time init
python3 manage.py db init(This is a one time task.) -
Migrate new changes
python3 manage.py db migrate -
Upgrade / Get new changes
python3 manage.py db upgrade
To run the development server, use: FLASK_DEBUG=1 flask run. Even python3 run.py works.
Please do make sure to change the directory to web before running the flask run
as the main application is inside web. cd web
Remember to set environment variables.
For local, kindly run the following command to get the mysql port:
ps aux | grep mysql
followed by.
export DB_PORT=3306
Also create a database for the migrations to run.
create database zapoo;
python -m unittest discover -s app -p "*_test.py"
All files which maintain any sort of connection with another service is maintained under the connections directory. Presently the MemSQL connection (DBweb.connections.py) and S3 connection (s3_connection.py) is maintained under this directory.
This has been done so that our parent directory is as clean as possible.
pip3 install app/requirements.txt
Before you can begin using Boto 3, you should set up authentication credentials. Credentials for your AWS account can be found in the IAM Console. You can create or use an existing user. Go to manage access keys and generate a new set of keys.
aws configure
Sample URL for S3 on local:
http://localhost:5000/api/s3-connect?file_name=113375995671546834861/0aa281948fvbq2v/2020/April/05e73376-7ec3-471e-b1e1-59919b660501.json