{"id":13502310,"url":"https://github.com/cburmeister/flask-bones","last_synced_at":"2025-05-16T14:04:48.541Z","repository":{"id":8644759,"uuid":"10294572","full_name":"cburmeister/flask-bones","owner":"cburmeister","description":"An example of a large scale Flask application using blueprints and extensions.","archived":false,"fork":false,"pushed_at":"2023-05-01T21:13:02.000Z","size":405,"stargazers_count":996,"open_issues_count":17,"forks_count":121,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-04-12T10:59:38.282Z","etag":null,"topics":["alembic","babel","docker","flask","rq","sqlalchemy","travis-ci","yarn"],"latest_commit_sha":null,"homepage":"http://flask-bones.herokuapp.com/","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/cburmeister.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":"2013-05-26T06:47:04.000Z","updated_at":"2025-03-30T23:00:16.000Z","dependencies_parsed_at":"2025-01-05T22:45:30.463Z","dependency_job_id":null,"html_url":"https://github.com/cburmeister/flask-bones","commit_stats":{"total_commits":229,"total_committers":11,"mean_commits":"20.818181818181817","dds":0.3187772925764192,"last_synced_commit":"bc61f5c12b50e366df605462ba227f5efc03bc1b"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cburmeister%2Fflask-bones","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cburmeister%2Fflask-bones/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cburmeister%2Fflask-bones/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cburmeister%2Fflask-bones/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cburmeister","download_url":"https://codeload.github.com/cburmeister/flask-bones/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254544146,"owners_count":22088807,"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":["alembic","babel","docker","flask","rq","sqlalchemy","travis-ci","yarn"],"created_at":"2024-07-31T22:02:09.498Z","updated_at":"2025-05-16T14:04:48.519Z","avatar_url":"https://github.com/cburmeister.png","language":"Python","funding_links":[],"categories":["Python","yarn"],"sub_categories":[],"readme":"![flasks](https://raw.githubusercontent.com/cburmeister/flask-bones/master/image.jpg)\n\nflask-bones\n===========\n\nAn example of a large scale Flask application using blueprints and extensions.\n\n[![Build Status](https://travis-ci.org/cburmeister/flask-bones.svg?branch=master)](https://travis-ci.org/cburmeister/flask-bones)\n\n## Setup\n\nQuickly run the project using [docker](https://www.docker.com/) and\n[docker-compose](https://docs.docker.com/compose/):\n```bash\ndocker-compose up -d\n```\n\nCreate the database and seed it with some data:\n```bash\ndocker-compose run --rm app flask create-db\ndocker-compose run --rm app flask populate-db --num_users 5\n```\n\nDownload front-end dependencies with [yarn](https://yarnpkg.com/en/):\n```bash\nyarn install --modules-folder ./app/static/node_modules\n```\n\n## Configuration\n\nThe following environment variables are *optional*:\n\n| Name             | Purpose                                          |\n|------------------|--------------------------------------------------|\n| `APP_NAME`       | The name of the application. i.e Flask Bones     |\n| `MAIL_PORT`      | The port number of an SMTP server.               |\n| `MAIL_SERVER`    | The hostname of an SMTP server.                  |\n| `MEMCACHED_HOST` | The hostname of a memcached server.              |\n| `MEMCACHED_PORT` | The port number of a memcached server.           |\n| `POSTGRES_HOST`  | The hostname of a postgres database server.      |\n| `POSTGRES_PASS`  | The password of a postgres database user.        |\n| `POSTGRES_PORT`  | The port number of a postgres database server.   |\n| `POSTGRES_USER`  | The name of a postgres database user.            |\n| `REDIS_HOST`     | The hostname of a redis database server.         |\n| `REDIS_PORT`     | The port number of a redis database server.      |\n| `SECRET_KEY`     | A secret key required to provide authentication. |\n| `SERVER_NAME`    | The hostname and port number of the server.      |\n\n## Features\n\n### Caching with Memcached\n\n```python\nfrom app.extensions import cache\n\n# Cache something\ncache.set('some_key', 'some_value')\n\n# Fetch it later\ncache.get('some_key')\n```\n\n### Email delivery\n\n```python\nfrom app.extensions import mail\nfrom flask_mail import Message\n\n# Build an email\nmsg = Message('User Registration', sender='admin@flask-bones.com', recipients=[user.email])\nmsg.body = render_template('mail/registration.mail', user=user, token=token)\n\n# Send\nmail.send(msg)\n```\n\n### Asynchronous job scheduling with RQ\n\n`RQ` is a [simple job queue](http://python-rq.org/) for python backed by\n[redis](https://redis.io/).\n\nDefine a job:\n```python\n@rq.job\ndef send_email(msg):\n    mail.send(msg)\n```\n\nStart a worker:\n```bash\nflask rq worker\n```\n\nQueue the job for processing:\n```python\nsend_email.queue(msg)\n```\n\nMonitor the status of the queue:\n```bash\nflask rq info --interval 3\n```\n\nFor help on all available commands:\n```bash\nflask rq --help\n```\n\n### Stupid simple user management\n\n```python\nfrom app.extensions import login_user, logout_user, login_required\n\n# Login user\nlogin_user(user)\n\n# You now have a global proxy for the user\ncurrent_user.is_authenticated\n\n# Secure endpoints with a decorator\n@login_required\n\n# Log out user\nlogout_user()\n```\n\n### Password security that can keep up with Moores Law\n\n```python\nfrom app.extensions import bcrypt\n\n# Hash password\npw_hash = bcrypt.generate_password_hash('password')\n\n# Validate password\nbcrypt.check_password_hash(pw_hash, 'password')\n```\n\n### Easily swap between multiple application configurations\n\n```python\nfrom app.config import dev_config, test_config\n\napp = Flask(__name__)\n\nclass dev_config():\n    DEBUG = True\n\nclass test_config():\n    TESTING = True\n\n# Configure for testing\napp.config.from_object(test_config)\n\n# Configure for development\napp.config.from_object(dev_config)\n```\n\n### Form validation \u0026 CSRF protection with WTForms\n\nPlace a csrf token on a form:\n```html\n{{ form.csrf_token }}\n```\n\nValidate it:\n```python\nform.validate_on_submit()\n```\n\n### Rate-limit routes\n```python\nfrom app.extensions import limiter\n\n@limiter.limit(\"5 per minute\")\n@auth.route('/login', methods=['GET', 'POST'])\ndef login():\n    # ...\n    return 'your_login_page_contents'\n```\n\n### Automated tests\n\nRun the test suite:\n```bash\npytest\n```\n\n### Use any relational database using the SQLAlchemy ORM\n\n```python\nfrom app.user.models import User\n\n# Fetch user by id\nuser = User.get_by_id(id)\n\n# Save current state of user\nuser.update()\n\n# Fetch a paginated set of users\nusers = User.query.paginate(page, 50)\n```\n\n### Front-end asset management\n\nDownload front-end dependencies with [yarn](https://yarnpkg.com/en/):\n```bash\nyarn install --modules-folder ./app/static/node_modules\n```\n\nMerge and compress them together with\n[Flask-Assets](https://flask-assets.readthedocs.io/en/latest/):\n```bash\nflask assets build\n```\n\n### Version your database schema\n\nDisplay the current revision:\n```bash\nflask db current\n```\n\nCreate a new migration:\n```bash\nflask db revision\n```\n\nUpgrade the database to a later version:\n```bash\nflask db upgrade\n```\n\n### Internationalize the application for other languages (i18n)\n\nExtract strings from source and compile a catalog (`.pot`):\n```bash\npybabel extract -F babel.cfg -o i18n/messages.pot .\n```\n\nCreate a new resource (.po) for German translators:\n```bash\npybabel init -i i18n/messages.pot -d i18n -l de\n```\n\nCompile translations (.mo):\n```bash\npybabel compile -d i18n\n```\n\nMerge changes into resource files:\n```bash\npybabel update -i i18n/messages.pot -d i18n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcburmeister%2Fflask-bones","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcburmeister%2Fflask-bones","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcburmeister%2Fflask-bones/lists"}