eventum

A content management system for event-driven Flask apps


License
MIT
Install
pip install eventum==0.2.7

Documentation

Eventum

Eventum is a content management system for an event-driven blog that syncs with Google Calendar.

Eventum

Getting Started

  1. First things first, make sure to install Eventum. To do so, use pip:

    pip install -U eventum
  2. Install MongoDB (Ubuntu Linux, OSX).

    On OSX, you may have to run mkdir /data /data/db before you can run mongod without errors.

  3. Install SASS gem

    gem install sass

    Otherwise, you will see an intermittent OSError

  4. Authorize your application with Google.

    $ python -m eventum.authorize <CLIENT-SECRET-PATH> <CLIENT-CREDENTIALS-PATH>
  5. Eventum needs to have several configuration variables set in the Flask config object in order to operate properly. These may be set as key/value pairs in a dictionary called EVENTUM_SETTINGS, or may be set individually with the prefix EVENTUM_.

    • INSTALLED_APP_CLIENT_SECRET_PATH: Path from the root of your project to the installed application client secret JSON file downloaded from Google.
    • INSTALLED_APP_CREDENTIALS_PATH: Path from the root of your project to the installed application credentials JSON file generated by the authorization in the previous step.
    • CLIENT_SECRETS_PATH: Path from the root of your project to the client secret JSON file
    • PRIVATE_CALENDAR_ID: The Google Calendar ID for the private calendar to which unpublished events should be synced.
    • PUBLIC_CALENDAR_ID: The Google Calendar ID for the public calendar to which published events should be synced.
    • UPLOAD_FOLDER: Path from the root of your project to the folder where uploaded images should be stored.
    • DELETE_FOLDER: Path from the root of your project to the folder where uploaded images that are then deleted should be stored.

    Here's an example of what that might look like:

    from flask import Flask
    app = Flask(__name__)
    app.config['EVENTUM_SETTINGS'] = {
        'INSTALLED_APP_CLIENT_SECRET_PATH': 'config/inst_client_secrets.json'
        'INSTALLED_APP_CREDENTIALS_PATH': 'config/inst_credentials.json'
        'CLIENT_SECRETS_PATH': 'config/oauth_client_secrets.json'
        'PRIVATE_CALENDAR_ID': 'abcdefg12345@group.calendar.google.com'
        'PUBLIC_CALENDAR_ID': 'zyxwvut98765@group.calendar.google.com'
        'UPLOAD_FOLDER': 'app/static/img/uploaded'
        'DELETE_FOLDER': 'app/static/img/uploaded/deleted'
    }
  6. Initialized the Eventum class, passing in your Flask app:

    from eventum import Eventum
    eventum = Eventum(app)

Configuration Options

Eventum can be configured using Flask configuration settings. Configurations can be supplied in a group, by defining key/value pairs in a dictionary called EVENTUM_SETTINGS, or they can be provided individually with the prefix EVENTUM_. Here are all of the Eventum configuration options, with their defaults. Note that CSRF_ENABLED is a Flask configuration and MONGODB_SETTINGS is a Mongoengine configuration:

# We enable Flask CSRF for secure forms.
CSRF_ENABLED = True

# We default to using the MongoDB 'eventum' database in Mongoengine
MONGODB_SETTINGS = {'DB': 'eventum'}

# Path the default profile picture to use in Eventum
EVENTUM_DEFAULT_PROFILE_PICTURE = 'img/default_profile_picture.png'

# Path to the default event image
EVENTUM_DEFAULT_EVENT_IMAGE = 'img/default_event_image.jpg'

# Whether or not Google Auth should be enabled or not.  If it is not enabled,
# you will default to a super-user account that bypasses all Google auth.
EVENTUM_GOOGLE_AUTH_ENABLED = True

# The name of the application log 
EVENTUM_APP_LOG_NAME = 'app.log'

# The name of the Werkzeug log 
EVENTUM_WERKZEUG_LOG_NAME = 'werkzeug.log'

# The maximum size of the Eventum logs 
EVENTUM_LOG_FILE_MAX_SIZE = 256

# The URL at which the Eventum admin interface should be mounted.
EVENTUM_URL_PREFIX = '/admin'

# File extensions that are allowed to be uploaded via the Media tab.
EVENTUM_ALLOWED_UPLOAD_EXTENSIONS = set(['.png', '.jpg', '.jpeg', '.gif'])

# The Eventum base path. If you're not sure what this is, don't mess with it.
EVENTUM_BASEDIR = eventum.__path__[0]

# Eventum static folder
EVENTUM_STATIC_FOLDER = path.join(EVENTUM_BASEDIR, 'static/')

# Eventum  SCSS folder
EVENTUM_SCSS_FOLDER = path.join(EVENTUM_STATIC_FOLDER, 'eventum_scss/')

# Eventum templates folder
EVENTUM_TEMPLATE_FOLDER = path.join(EVENTUM_BASEDIR, 'templates/')

######################
# Must be overridden #
######################

# Path from the root of your project to the installed application client
# secret JSON file downloaded from Google.
EVENTUM_INSTALLED_APP_CLIENT_SECRET_PATH = None

# Path from the root of your project to the installed application credentials 
# JSON file generated by the authorization in the previous step.
EVENTUM_INSTALLED_APP_CREDENTIALS_PATH = None

# Path from the root of your project to the client secret JSON file 
EVENTUM_CLIENT_SECRETS_PATH = None

# The [Google Calendar ID][gcal-id] for the private calendar to which
# unpublished events should be synced.
EVENTUM_PRIVATE_CALENDAR_ID = None

# The [Google Calendar ID][gcal-id] for the public calendar to which published
# events should be synced.
EVENTUM_PUBLIC_CALENDAR_ID = None

# Path from the root of your project to the folder where uploaded images
# should be stored. 
EVENTUM_UPLOAD_FOLDER = None

# Path from the root of your project to the folder where uploaded images that
# are then deleted should be stored.
EVENTUM_DELETE_FOLDER = None

# Will be set elsewhere, do not set directly
EVENTUM_GOOGLE_CLIENT_ID = None

Developing

Here's how to run Eventum in a development environment:

mongod &
python setup.py devlelop

Developing without Authentication

It is possible to run Eventum without logging in using Google+ or authenticating with Google Calendar. To do so, set the Flask configuration variable EVENTUM_GOOGLE_AUTH_ENABLED to FALSE:

# Whether or not to enable Google Auth or not.
echo $EVENTUM_GOOGLE_AUTH_ENABLED

Publishing to PyPI

Follow the Peter Down's tutorial to get setup, and then you can do several things:

Publish to PyPI Testing:

python setup.py sdist upload -r pypitest

Publish to PyPI Live:

python setup.py sdist upload -r pypi

About Eventum

Stack

Organization / Structure

.
├── docs             # Builds our Sphinx documentation
├── eventum          # The Eventum module
│   ├── forms        # Flask-WTForms models, used for generating forms in HTML
│   │                #     and validating input
│   ├── lib          # Misc helpers, tasks, and modular libraries
│   ├── models       # Mongoengine Models
│   ├── routes       # All Flask routes, using Blueprints
│   ├── static
│   │   ├── css      # CSS
│   │   │   └── lib  # CSS libraries
│   │   ├── img      # Images
│   │   ├── js       # Javascript files
│   │   └── eventum_scss    # Stylesheets
│   ├── templates    # HTML templates
│   └── __init__.py  # All app-wide setup.  Called by `run.py`
└── Manifest.in      # Files to be included in the app.

Screenshots

home editors events