{"id":20282615,"url":"https://github.com/veops/flask-api-template","last_synced_at":"2025-04-11T08:09:50.726Z","repository":{"id":184198929,"uuid":"671469921","full_name":"veops/flask-api-template","owner":"veops","description":"A lightweight RESTful API template based on Flask","archived":false,"fork":false,"pushed_at":"2023-10-25T07:50:08.000Z","size":30,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2023-10-25T08:53:57.774Z","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/veops.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}},"created_at":"2023-07-27T11:45:44.000Z","updated_at":"2023-09-11T12:10:28.000Z","dependencies_parsed_at":"2023-07-27T14:15:41.350Z","dependency_job_id":"761f4890-678b-4563-b947-9e547dd988c1","html_url":"https://github.com/veops/flask-api-template","commit_stats":null,"previous_names":["veops/flask-api-template"],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veops%2Fflask-api-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veops%2Fflask-api-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veops%2Fflask-api-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veops%2Fflask-api-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/veops","download_url":"https://codeload.github.com/veops/flask-api-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224632812,"owners_count":17343926,"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":[],"created_at":"2024-11-14T14:10:35.085Z","updated_at":"2024-11-14T14:10:35.873Z","avatar_url":"https://github.com/veops.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Open Flask API\nA lightweight RESTful API template based on Flask, which supports Python 2.7 and 3.6+\n\n## Project Structure\n\n### `api.lib` - Main App Library\nThis framework is designed with the Model-View-Controller pattern, hence `api.lib` is the controller of this application.\n### `api.models` - ORMs\nPer name, ORM database models should be located under this directory. This project uses `sqlalchemy` to implement models. For instance, `api.models.your_app.hello` has a model `Hello` which binds to database table `hello`.\n\n### `api.views` - Views for API\nThis directory hosts all API entries of the application. Upon starting, all files under `api/views/*` are scanned for subclass of `APIView` and to have those subclasses registered as API entries. E.g. `api.views.your_app.hello.py` implements `HelloWorldView` class which inherents the class `APIView` and it shall be registered onto the entry point `/api/v0.1/hello` \n\n### `api.tasks` - Celery Tasks\nCelery is used for implementing tasks in this project, and all tasks related code shall be located in `api.tasks`.\n\n### `api.commands` - Command Line Tools\nBesides the running RESTful API, this project implements command line tools using Click and has them integrated in the flask app. Any functions in `api.commands.*` decorated with `@click.command()` is registered under its name in cabab-case as click command and they should be run like `flask your-command-name`\n\n\n## Environment Configuration\nIt is recommended to use `pipenv` for environment configuration and management for this project. A virtualenv will be automatically created upon the initial activation of pipenv for the project directory.\n\n#### Activate pipenv virtual environment\n```\npipenv shell\n```\n\n#### Install Requirements\n```\npipenv install\n```\n\nThis will install requirements in `Pipfile`\n\n#### Environmental Variables\n\nA `.env` file is provided for environmental variable settings which contains some settings for the project. Please make sure the `SECRET_KEY` is set up properly before continue.\n\n\n## Run the Project\n\n#### Settings File\nBefore run the project, make sure you have a `settings.py` under current directory and an example settings file is provided.\n\n```\ncp settings.example.py settings.py\n```\n\n#### Flask App\nTo run the RESTful API, use the following command. The RESTful API will by default serve at `http://127.0.0.1:5000/api/v0.1/`\n\n```\nflask run\n```\n\n#### Celery Tasks\nTo run the celery tasks, use the following command.\n\n```\ncelery -A celery_worker.celery worker --concurrency=2 -E -Q {queue name} --logfile={queue name}.log --pidfile={queue name}.pid -D\n```\n\n#### Command Line Tools\n\n```\nflask what-ever-command\n```\n\n\n\n\n## TL;DR\nFirst clone the project and to the following.\n### Install Dependency\n```\npipenv shell\npipenv install\ncp settings.example.py settings.py\n```\n### Start Project\n```\nflask run\n```\nVisit http://127.0.0.1:5000/api/v0.1/hello\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fveops%2Fflask-api-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fveops%2Fflask-api-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fveops%2Fflask-api-template/lists"}