Introduction
This is an application for the test proposed by Telavita for a job opportunity as a Senior Back-end developer.
It is written in Python using framework Flask, the ORM SQL Alchemy and a MySQL database server.
For more information about the test itself, follow this link
If you're looking for the API's documentation and reference guide, follow this Postman Link
Requirements
Dependencies
- Flask
- Flask SQL Alchemy
- PyMySQL
Installation Steps
- Download the project on your computer and unzip it under some folder. (Ex.: /foo/bar/acmevita)
- Open up your terminal and navigate to its folder:
cd /foo/bar/acmevita
- Create a Python virtual environment:
python3 -m venv venv
- Activate Python virtual environment:
source venv/bin/activate
- Install the dependencies:
Install Flask Framework:
pip install flask
Install PyMySQL:
pip install pymysql
Install Flask-SQLAlchemy:
pip install flask_sqlalchemy
Configuration
Under the root folder of the project(Ex.: /foo/bar/acmevita) you will find a file named config.json. This file contains all configs that you must do in order to run this Acmevita Application, such as Database settings and so on.
Here's an example:
{
"dbconfigs": {
"dbhost": "localhost",
"dbname": "acmevita",
"dbuser": "acmevita",
"dbpass": "Senha123#",
"dbport": 3306
}
}
Just change "dbconfigs" to fulfill your database setup.
Running the Application
- From a terminal, navigate to the application's root folder:
cd /foo/bar/acmevita
- Activate the Python Virtual Environment:
source venv/bin/activate
- Run the application itself:
python main.py
Done and done! Now you can access its API's endpoints to see data at "localhost:5000". The documentation and reference guide about the API is documented on this Postman Link
OBS: You can populate database automatically with dummy data accessing endpoint "/populate". See documentation and reference guide for further info