{"id":21740731,"url":"https://github.com/murphyadam/flask-blog","last_synced_at":"2025-03-21T01:15:10.683Z","repository":{"id":186536207,"uuid":"272082096","full_name":"MurphyAdam/Flask-Blog","owner":"MurphyAdam","description":"Simple sample Flask app to be deployed on Heroku","archived":false,"fork":false,"pushed_at":"2020-06-13T21:18:47.000Z","size":466,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-20T16:57:19.739Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MurphyAdam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-06-13T20:37:04.000Z","updated_at":"2020-06-13T21:18:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"f8a524db-524e-4afc-b289-86c7bd6f9147","html_url":"https://github.com/MurphyAdam/Flask-Blog","commit_stats":null,"previous_names":["murphyadam/flask-blog"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MurphyAdam%2FFlask-Blog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MurphyAdam%2FFlask-Blog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MurphyAdam%2FFlask-Blog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MurphyAdam%2FFlask-Blog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MurphyAdam","download_url":"https://codeload.github.com/MurphyAdam/Flask-Blog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244717338,"owners_count":20498284,"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-26T06:15:05.362Z","updated_at":"2025-03-21T01:15:10.650Z","avatar_url":"https://github.com/MurphyAdam.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple sample Flask app to be deployed on Heroku\n\n## Introduction\nThis is a Flask-based web app that supports a number of functionalities, including:\n+ Authentication: Sign-in, Sign-up, Forgot password, etc\n+ Blog CRUD: Can create blog posts using the Quill WYSIWYG\n+ Categories and tags for blog posts\n+ Save and Heart blog posts\n+ Comment on posts and delete comments\n+ Follow, and unfollow users\n+ Change user role, suspend and unsuspend a user, delete user\n+ Some good decorators such as account_state() that takes care if an account is suspended, if yes, it displays a cool page informing the user.\n+ Adds a MASTER_PASSWORD for etc security for operations like suspending and deleting users and changing their roles\n+ Edit your profile, change password, delete account.\n+ Built-in HTTP error messages handlers\n+ Has support for CSRF tokens to protect you against CSRF attacks\n\nThis samlpe app is built with the [Flask Application Factory Pattern](https://flask.palletsprojects.com/en/1.1.x/patterns/appfactories/) in mind alongside the use of [Blueprints](https://flask.palletsprojects.com/en/1.1.x/blueprints/#blueprints)\n\n## Files and directories in the app\n\n```console\n\n.\n├── app\n│   ├── ajax\n│   ├── api\n│   ├── article\n│   ├── auth\n│   ├── data_retrieval.py\n│   ├── decorators.py\n│   ├── email.py\n│   ├── errors\n│   ├── exceptions.py\n│   ├── forms.py\n│   ├── functions.py\n│   ├── __init__.py\n│   ├── main\n│   ├── models.py\n│   ├── static\n│   ├── templates\n│   └── user\n├── config.py\n├── db.sqlite3\n├── logs\n│   ├── applog.log\n├── migrations\n│   ├── alembic.ini\n│   ├── env.py\n│   ├── README\n│   ├── script.py.mako\n│   └── versions\n├── Procfile\n├── README.md\n├── requirements.txt\n├── runtime.txt\n├── tests.py\n└── wsgi.py\n```\n\n\n## Usage\n\ngit clone or download this repository.\n\nI assume you have Python and PIP installed on your machine. If not, please do.\nAlso you need to have Postgres database installed and running (if you donnot install or use Postgres db\n, an sqlite db is used instead. You can use any db of choice you like. To learn more about that, please refer to Flask-Sqlalchemy and Sqlalechemy docs.)\n\n```python\npip install requirements.txt\n```\n\nFlask enviroment variables:\n\nOn Linux\n```console\nfoo@bar:~$ export FLASK_APP=wsgi.py\nfoo@bar:~$ export FLASK_ENV=development\n```\n\nOn Windows\n```console\nfoo@bar:~$ set FLASK_APP=wsgi.py\nfoo@bar:~$ set FLASK_ENV=development\n```\n\nIf everything is good, now we have to map our db models to our db of choice. Luckly this is easly done:\n\n```python\nfoo@bar:~$ flask db init\nfoo@bar:~$ flask db migrate\nfoo@bar:~$ flask db upgrade\n```\nAt this point all should be good, now you just need to run the application:\n\n```python\nfoo@bar:~$ flask run\n```\n\n## Deployment\n\nI wrote a blog post on how to deploy a Flask app on Heroku [here](https://langcodex.herokuapp.com/posts/34) It deals specifically with deploying a chatbot, but it is the same. If you are interested in that you can check my Flask-based chatbot app source code, refer to [here](https://github.com/MurphyAdam/langandcode)\n\n## Hint\nTo make an account associated with a specific email an admin, make sure you specify it in the ADMINS_EMAILS_WHITELIST in the config.py file. These emails are created with the Admin flag to give you permissins to CRUD. You can also make a user an admin or vise versa accessing their account.\n\nTo have your admin account confirmed automatically, in the __init__ of the User Class in the models.py \nset self.confirmed to True, recommended only for development purposes.\n```python\nself.confirmed = False\n```\n\n## Contributions\nYou are free to use and or modify this code as you wish, if you run into problems regarding the app, please issue a problem. Thank you\n\n## Warranty\nThis app comes with absolutely no warranty whatsoever.\n\n## License\n[CC-BY](https://creativecommons.org/licenses/by/3.0/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmurphyadam%2Fflask-blog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmurphyadam%2Fflask-blog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmurphyadam%2Fflask-blog/lists"}