{"id":17018176,"url":"https://github.com/loitd/myflask","last_synced_at":"2025-10-11T05:08:04.859Z","repository":{"id":42650062,"uuid":"277950433","full_name":"loitd/myflask","owner":"loitd","description":"My Python Flask Template","archived":false,"fork":false,"pushed_at":"2022-12-08T11:16:20.000Z","size":1056,"stargazers_count":1,"open_issues_count":11,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T20:14:05.620Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/loitd.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}},"created_at":"2020-07-08T00:24:02.000Z","updated_at":"2020-08-26T18:27:53.000Z","dependencies_parsed_at":"2023-01-25T05:00:13.404Z","dependency_job_id":null,"html_url":"https://github.com/loitd/myflask","commit_stats":null,"previous_names":[],"tags_count":2,"template":true,"template_full_name":null,"purl":"pkg:github/loitd/myflask","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loitd%2Fmyflask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loitd%2Fmyflask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loitd%2Fmyflask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loitd%2Fmyflask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loitd","download_url":"https://codeload.github.com/loitd/myflask/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loitd%2Fmyflask/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006335,"owners_count":26084083,"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","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-14T06:44:47.269Z","updated_at":"2025-10-11T05:08:04.845Z","avatar_url":"https://github.com/loitd.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# myflask\n[![codecov](https://codecov.io/gh/loitd/myflask/branch/master/graph/badge.svg)](https://codecov.io/gh/loitd/myflask)\n[![lutils](https://circleci.com/gh/loitd/myflask.svg?style=svg)](https://circleci.com/gh/loitd/myflask)\n[![](https://img.shields.io/github/v/release/loitd/myflask?include_prereleases)](https://img.shields.io/github/v/release/loitd/myflask?include_prereleases)\n[![](https://img.shields.io/github/repo-size/loitd/myflask)](https://img.shields.io/github/repo-size/loitd/myflask)\n## Links\n* Demo: [https://loi-flask.herokuapp.com/](https://loi-flask.herokuapp.com/)\n* Page: [https://loitd.github.io/myflask/](https://loitd.github.io/myflask/)\n* Github: [https://github.com/loitd/myflask](https://github.com/loitd/myflask)  \nMy Python Flask Template with:  \n\nAPP1  \n* Modular Flask with Blueprint\n* Pre-configured [SQLAlchemy ORM](https://flask-sqlalchemy.palletsprojects.com/en/2.x/) (to MySQL, Oracle, SQLite, Postgres)\n* Fully responsive using frontend with [Bootstrap 4](http://getbootstrap.com/), [Chart.js](https://www.chartjs.org/docs/latest/), [FeatherIcon](https://feathericons.com/)\n* Coding, testing and deploying automated using CI/CD with [Pytest](https://docs.pytest.org/en/stable/), [Codecov](https://docs.codecov.io/docs/python), [Circle CI](https://circleci.com/), [Heroku](https://loi-flask.herokuapp.com/).\n* Social authentications beside classic email/password.\n* Backend API with Flask\n* Dockerized with Docker Compose (guide below)\n* CSRF protection/Form validation with [Flask-WTF](http://packages.python.org/Flask-WTF/)\n* Login Manager with [Flask-Login](https://flask-login.readthedocs.org/en/latest/)\n* RBAC with [Flask-Principle](http://packages.python.org/Flask-Principal/)\n* Migrated with [Flask-Migrate]() from v1.2 (was commandline before)\n* SQLInjection prevention with tips at [this](https://realpython.com/prevent-python-sql-injection/#executing-a-query) and [this](https://viblo.asia/p/tim-hieu-ve-sql-injection-testing-RQqKLv90l7z) and [this](https://www.thepythoncode.com/code/sql-injection-vulnerability-detector-in-python). Security tests provided in `tests/test_app1/securities/` folder. (from v1.2)\n* Performance tests with [Locust](https://docs.locust.io/en/stable/quickstart.html) (from v1.2) with Failures ratio ~ 8%\n    - `locust -f tests\\test_app1\\performance\\test_perf_locust.py`  \n\nAPP2  \n* API with [Celery asynchronous task queue](https://docs.celeryproject.org/en/stable/) (Redis as broker \u0026 result backend, gevent or threads)\n    - Pre-configured + samples Celery with Flask with status update\n## Installation\nThis is how to install this template:  \n### Linux\n* `git clone https://github.com/loitd/myflask.git`  \n* `cd myflask`  \n* `python -m venv venv`\n* `source venv/bin/activate`\n* `(venv) pip install -r requirements.txt`  \n* `(venv) export FLASK_APP=app1`\n* `(venv) export FLASK_ENV=test`\n* `(venv) export GH_CLIENT_KEY=******`\n* `(venv) export GH_CLIENT_SECRET=******`\n* `(venv) export GG_CLIENT_ID=******`\n* `(venv) export GG_CLIENT_SECRET=******`\n* `(venv) flask db upgrade`  \n* `(venv) flask run`  \n### Docker\n* Clone to your local:  \n`git clone https://github.com/loitd/myflask \u0026\u0026 cd myflask`   \n* Update your keys pre-configured with samples at `docker-compose.yml`  \n* Turn the whole up with `docker-compose`: `sudo docker-compose up`  \n## Notes\n* `Python 3.7` is recommended\n* `Python 3.7.8` tested with\n* Do NOT use `mysqlclient==2.0.1` since it has problem installing on Docker. Moved to `PyMySQL==0.10.0`. Modify database URL to: `mysql+pymysql://...`  \n* Do NOT use `psycopg2==2.8.5` since it has problem installing on Docker. Moved to `pg8000==1.16.3`. Then in the database URL, modify to: `postgresql+pg8000://...`  \n* You can NOT run `source venv/bin/activate` command in Docker. You need to specify to `venv/bin/flask` for EVERY Python command.  \n* In any case, keep ONLY ONE of `Pipfile` or `requirements.txt` in your project.  \n* To setup data base and data seed on Heroku:  \n    - Select run console  \n    ![Run console](https://github.com/loitd/myflask/blob/master/heroku-config-01.png?raw=true)\n    - Run `flask add-seed` command just like in the dev/test env  \n    ![Run console](https://github.com/loitd/myflask/blob/master/heroku-config-02.png?raw=true)\n    - Wait until you see this text in the console: `[add_seed] Database initialized!`  \n* `flask add-seed` command gives you all database setup and 2 default users with default password `123456` for both:\n    - `admin@myflask.com` as an administrator account  \n    - `user@myflask.com` as a normal user account  \n## For developers\n* List of APIs:\n    - `/api/v1_0/swich`: Command management\n    - `/api/v1_0/updateuser`: User profile management (for frontend)\n* Push to Docker hub\n    - switch to `root`  \n    - `docker login`  \n    - `docker images`\n    - `docker push imagename`  \n* Rebuild if any change:  \n    - `sudo docker-compose build`\n* About Migration: [Introduction](https://github.com/loitd/myflask/blob/master/migration.md)\n* More performance tests:\n    - ![Perf Test](https://github.com/loitd/myflask/blob/master/myflask_locust_perf_test.png?raw=true)  \n    - ![Perf Test](https://github.com/loitd/myflask/blob/master/response_times_ms_1596651398.png?raw=true)\n    - ![Perf Test](https://github.com/loitd/myflask/blob/master/total_requests_per_second_1596651397.png?raw=true)\n## License\n* [License](https://github.com/loitd/myflask/blob/master/LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floitd%2Fmyflask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floitd%2Fmyflask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floitd%2Fmyflask/lists"}