{"id":19892011,"url":"https://github.com/liuyuweitarek/flask_mysql_quicktemplate","last_synced_at":"2026-04-11T17:03:45.282Z","repository":{"id":128616216,"uuid":"468916819","full_name":"liuyuweitarek/Flask_MySQL_QuickTemplate","owner":"liuyuweitarek","description":"This is a quick template which help you build up backend with Flask + MySQL and handle config and API functions clearly. ","archived":false,"fork":false,"pushed_at":"2022-03-12T02:00:45.000Z","size":324,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-11T19:43:06.916Z","etag":null,"topics":["flask","mysql","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/liuyuweitarek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-11T22:25:55.000Z","updated_at":"2023-04-08T04:28:03.000Z","dependencies_parsed_at":"2023-05-25T13:31:11.757Z","dependency_job_id":null,"html_url":"https://github.com/liuyuweitarek/Flask_MySQL_QuickTemplate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liuyuweitarek%2FFlask_MySQL_QuickTemplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liuyuweitarek%2FFlask_MySQL_QuickTemplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liuyuweitarek%2FFlask_MySQL_QuickTemplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liuyuweitarek%2FFlask_MySQL_QuickTemplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liuyuweitarek","download_url":"https://codeload.github.com/liuyuweitarek/Flask_MySQL_QuickTemplate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241319565,"owners_count":19943554,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flask","mysql","python"],"created_at":"2024-11-12T18:20:55.941Z","updated_at":"2025-12-31T01:11:33.537Z","avatar_url":"https://github.com/liuyuweitarek.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flask_MySQL_QuickTemplate\nThis is a quick template which help you build up backend with Flask + MySQL and handle config and API functions clearly. \n\n## Installation\n\n1. Clone the project\n\n    ```bash\n    $ git clone https://github.com/liuyuweitarek/Flask_MySQL_QuickTemplate.git\n    $ cd Flask_MySQL_QuickTemplate\n    ```\n\n2. Build Project Python Environment\n\n    Python Version \u003e 3\n    \n    * Set up/Start up virtual env\n      ```bash\n      $ python3 -m venv env\n      $ source env/bin/activate\n      ```\n    * Install Dependencies\n      ```bash\n      $ python -m pip install --upgrade pip\n      $ pip install -r requirements.txt \n      ```\n\n3. Set up MySQL Environment\n     * [MySQL Installation Guideline:](https://dev.mysql.com/doc/mysql-installation-excerpt/5.7/en/) Follow the instructions based on your OS system. \n     * Create the database for this project\n       ```bash\n        $ mysql -u root -p\n          (input password)\n        $ mysql\u003e CREATE DATABASE {DATABASENAME}_dev ;\n        $ mysql\u003e CREATE DATABASE {DATABASENAME}_prod ;\n       ```\n        \n       If you are not root, you could ask your admin for creating databases and granting the privileges to you with adding the commands below.\n       ```bash\n        (In root account)\n        $ mysql\u003e GRANT ALL PRIVILEGES ON {DATABASENAME}_dev.* TO '{ACCOUNT}'@'%';\n        $ mysql\u003e GRANT ALL PRIVILEGES ON {DATABASENAME}_prod.* TO '{ACCOUNT}'@'%';\n       ```\n       P.S. If the error shows that it can't find the user, using the code down below to check your account identity\n       ```bash\n        $ SELECT User FROM mysql.user;\n        \n        # It shows like:\n        +------------------+--------------+--------------+\n        | user             | host         | password     |\n        +------------------+--------------+--------------+\n        | {ACCOUNT}        | localhost    | 37as%#8123fs |\n        | Other_user       | %            | slclk2j393   |\n        +------------------+--------------+--------------+\n        1 rows in set (0.01 sec)\n       ```\n       Based on the columns, \"user\" and \"host\", on User table, you might need to change the commands to :\n       ```bash\n        (In root account)\n        $ mysql\u003e GRANT ALL PRIVILEGES ON {DATABASENAME}_dev.* TO '{ACCOUNT}'@'localhost';\n        $ mysql\u003e GRANT ALL PRIVILEGES ON {DATABASENAME}_prod.* TO '{ACCOUNT}'@'localhost';\n       ```\n 4. Modify cfg.py's config\n    ```python\n    class ProductionConfig:\n      ...\n      HOST = {YOUR IP ADDRESS}                                                              \u003c= Edit              \n      PORT = {PORT which is available on your machine}                                      \u003c= Edit\n      ...\n\n      # SQL\n      SQLALCHEMY_DATABASE_URI= \"mysql://{ACCOUNT}:{PASSWORD}@127.0.0.1/{DATABASENAME}_prod\" \u003c= Edit\n      ...\n\n    class DevelopmentConfig:\n      ...\n      HOST = {YOUR IP ADDRESS}                                                              \u003c= Edit\n      PORT = {PORT which is available on your machine}                                      \u003c= Edit\n      ...\n\n      # SQL\n      SQLALCHEMY_DATABASE_URI= \"mysql://{ACCOUNT}:{PASSWORD}@127.0.0.1/{DATABASE_NAME}_dev\" \u003c= Edit\n      ...\n    \n    ```\n ## Usage\n 1. Make sure that MySQL Service active correctly\n    ```bash\n    $ service mysql status\n    ```\n    \u003cp align=\"center\"\u003e\n      \u003cimg src=\"https://github.com/liuyuweitarek/Flask_MySQL_QuickTemplate/blob/main/wiki/mysql_service_check.jpg\"\u003e\n    \u003c/p\u003e\n 2. Activate project python environment \n     ```bash\n     $ cd ~/Flask_MySQL_QuickTemplate\n     $ source env/bin/activate\n     $ export PYTHONPATH=src\n     ```\n 3. Run\n    ```bash\n     $ python run.py --config [dev, prod]\n    ```\n\n## Test\n**[ GET API ] :** {YOUR_IP_ADDRESS}:{PORT}/GET/dev_or_prod\n\n\n**[ POST API ] :** {YOUR_IP_ADDRESS}:{PORT}/POST/storedata\n\n\u003cp align=\"center\"\u003e\n      \u003cimg src=\"https://github.com/liuyuweitarek/Flask_MySQL_QuickTemplate/blob/main/wiki/POST_DEMO.jpg\"\u003e\n      \u003cimg src=\"https://github.com/liuyuweitarek/Flask_MySQL_QuickTemplate/blob/main/wiki/POST_DEMO_dashboard.jpg\"\u003e\n\u003c/p\u003e\n\n\n       \n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliuyuweitarek%2Fflask_mysql_quicktemplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliuyuweitarek%2Fflask_mysql_quicktemplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliuyuweitarek%2Fflask_mysql_quicktemplate/lists"}