[Contributor] [Forks] [Stargazers] [Issues] [MIT License]
Table of Contents
This source show you a basic microservices system with python language and Flask framework. There are 2 mini services that connect directly with its apis:
- Authentication service
- signup
- login
- Video service
- create new video
- get list videos
This section should list any major frameworks/libraries used for your project. Leave any add-ons/plugins for the acknowledgements section. Here are a few examples.
This is an example of how you may give instructions on setting up your project locally.
This is an example of how to list things you need to use the software and how to install them.
- [Download python 3.7]
- [Install pip]
- [Download and install mysql database]
- [Download postman to testing api]
Below is an instruction for installing and setting up auth_service. Do the same with video_service.
-
Clone the repo
git clone https://github.com/ncsyvn/microservices-flask-python-example.git
-
Install library
* Create virtual environent (venv/conda/...) * Active venv in terminal * pip install -r auth_service/requirements.txt
-
Migrate db
After migrate database successfully, we will have "migrations" folder in auth_app. Besides, in mysql db, we will see 2 new tables: user, token
* Change database uri in settings file: Example: SQLALCHEMY_DATABASE_URI = 'mysql://root:123456@127.0.0.1:3306/auth_service' * Open new terminal -> Go to "auth_service/auth_app" folder * cmd: 1. flask db init 2. flask db migrate -m "message you want" 3. flask db upgrade
-
Run code
After install step 2&3 with both auth_service and video_service.
Run 2 apps in 2 different ports (example: 5012 & 5013).
This is the postman collection to testing your API
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.
Cong Sy Nguyen - ncsyvn@gmail.com
Other projects: https://github.com/ncsyvn?tab=repositories