copy .env.example inside "application" and renamed to .env
cp .env.example application/.env
cd docker
docker-compose up --build
It's make a server running faster.
1º run database:
cd docker-dev
docker-compose up --build
2º run python
pip install -r requirements.txt
cd application
python main.py
- add permissions to write, ex: sudo chmod -R 775 ./docker/mongo-volume
- if you wish to change ports, just change oin .env and docker-compose.yml
I use a compound from Flask and Connexion, I never done a complete server in Python before, then I used some knowledge thequinices from other environments. A model folder remains for manage future web-server requests, and I used resources nomenclature, to use in REST.
And choice PyCharm IDE for dev.
In swagger doc, are additional information about implementation of each end-point.
I opted by an Swagger environment, because it is family to me, and a good comercial resource.
Swagger can handle requests and pass it as normalized data to "api resources". I preferred dispend time writing data models than make the risk to made security functions by myself inside model/resources.
If pytest has successful instaled, run in project's root:
pytest --rootdir=./application/ -v
This is the entry point used in devlopment tests:
http://localhost:5050/api/partner/search?lat=-43.297337&lon=-23.013538&radius=10
http://localhost:5050/api/partner/1
http://localhost:5050/api/partner
data example:
{
"tradingName": "TESTE Adega Osasco ",
"ownerName": "Ze da Ambev",
"document": "02.453.716/000170",
"coverageArea": {
"type": "MultiPolygon",
"coordinates": [
[
[
[
-43.36556,
-22.99669
],
[
-43.36539,
-23.01928
],
[
-43.26583,
-23.01802
],
[
-43.36556,
-22.99669
]
]
]
]
},
"address": {
"type": "Point",
"coordinates": [
-43.297337,
-23.013538
]
}
}