<commit_before># Redberry CMS

Redberry is a Blueprint for adding CMS functionality into your Flask app. 
It is intended to be registered into an existing Flask app, not as a standalone application.

## Features
- Start using Redberry in your Flask app in 3 lines
- Display posts and categories
- Create, update, and delete in the included admin panel
- Includes rich text editor
- Customizable templates
- Built with Bootstrap for easy modification, and mobile-optimized / responsive
- Automatically generated sitemap
- Automatically generated [Accelerated Mobile Pages](https://www.ampproject.org) versions of all pages. Just add `.amp` to the end of URLs for posts and categories.
- Automatically included [JSON-LD](http://json-ld.org/) meta data for improved SEO

## Installation
`pip install redberry`

## Usage
```
from redberry.blueprint import cms

# Pass a SQLAlchemy object as db
app.config['redberry.config'] = {'db': db}

# Set the url_prefix for where your CMS should be served from
app.register_blueprint(cms, url_prefix='/blog')

....

# Ensure your user instances implement an is_admin() method
# eg models/user.py
class User:
    def is_admin(self):
        return self.role == 'ADMIN'
```<commit_msg>Update readme for app context.<commit_after># Redberry CMS

Redberry is a Blueprint for adding CMS functionality into your Flask app. 
It is intended to be registered into an existing Flask app, not as a standalone application.

## Features
- Start using Redberry in your Flask app in 3 lines
- Display posts and categories
- Create, update, and delete in the included admin panel
- Includes rich text editor
- Customizable templates
- Built with Bootstrap for easy modification, and mobile-optimized / responsive
- Automatically generated sitemap
- Automatically generated [Accelerated Mobile Pages](https://www.ampproject.org) versions of all pages. Just add `.amp` to the end of URLs for posts and categories.
- Automatically included [JSON-LD](http://json-ld.org/) meta data for improved SEO

## Installation
`pip install redberry`

## Usage
```
from redberry.blueprint import cms

# Pass a SQLAlchemy object as db
app.config['redberry.config'] = {'db': db}

## EITHER
## If you create your db object using `db.init_app(app)` you will need:
with app.app_context():
    # Set the url_prefix for where your CMS should be served from
    app.register_blueprint(cms, url_prefix='/content')

## OR
## If you create your db object using `db = SQLAlchemy(app, session_options={...})`
app.register_blueprint(cms, url_prefix='/blog')

....

# Ensure your user instances implement an is_admin() method
# eg models/user.py
class User:
    def is_admin(self):
        return self.role == 'ADMIN'
```
{'fraction_non_alphanumeric': 0.08970099667774087, 'fraction_numerical': 0.0007382798080472499, 'mean_word_length': 4.272373540856031, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1905801', 'n_tokens_mistral': 780, 'n_tokens_neox': 751, 'n_words': 331}