-
-
Save amcgregor/c425ac5c515832975665011c5b2cfa07 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from os import getenv as config | |
# The template engine needs to be registered as a file encoding, so import it. | |
__import__('cinje') # But we don't actually care about the result, just module execution. | |
# The core of it all. | |
from web.core.application import Application | |
# Load up the WebCore extensions we plan on using. | |
from web.ext.acl import ACLExtension | |
from web.ext.annotation import AnnotationExtension | |
from web.ext.assets import WebAssetsExtension | |
from web.ext.db import DBExtension | |
from web.ext.session import SessionExtension | |
from web.ext.serialize import SerializationExtension | |
from web.db.mongo import MongoDBConnection | |
from web.session.mongo import MongoSession | |
if __debug__: # We only run the timer and debugger in development. | |
from web.ext.analytics import AnalyticsExtension | |
from web.ext.debug import DebugExtension | |
from .controller import Root | |
from ..session import Session | |
DB_URI = config('MONGODB_ADDON_URI', 'mongodb://localhost/illico') | |
SESSION_SECRET = config('SESSION_SECRET', None) | |
app = Application( | |
Root, | |
extensions = [ | |
ACLExtension(), | |
AnnotationExtension(), | |
DBExtension(MongoDBConnection(DB_URI, minimum_version=(3, 2))), | |
SessionExtension( | |
secret = SESSION_SECRET, | |
expires = 24 * 90, | |
default = MongoSession(Session), | |
), | |
SerializationExtension(), | |
WebAssetsExtension( | |
'public', | |
'/public', | |
{ | |
'illico.rita_js', | |
'illico.rita_css', | |
}, | |
manifest = 'json:assets.json', | |
debug = __debug__, | |
), | |
] + ([AnalyticsExtension(), DebugExtension()] if __debug__ else []), | |
logging = { | |
'version': 1, | |
'handlers': { | |
'console': { | |
'class': 'logging.StreamHandler', | |
'formatter': 'json', | |
'level': 'DEBUG' if __debug__ else 'INFO', | |
'stream': 'ext://sys.stdout', | |
}, | |
'db': { | |
'class': 'marrow.mongo.util.logger.MongoHandler', | |
'uri': DB_URI, | |
'collection': 'logs', | |
'level': 'DEBUG' if __debug__ else 'INFO', | |
} | |
}, | |
'loggers': { | |
'illico': { | |
'level': 'DEBUG' if __debug__ else 'INFO', | |
'handlers': ['console', 'db'], | |
'propagate': False, | |
}, | |
'web': { | |
'level': 'INFO' if __debug__ else 'WARN', | |
'handlers': ['console', 'db'], | |
'propagate': False, | |
}, | |
}, | |
'root': { | |
'level': 'DEBUG' if __debug__ else 'WARN', | |
'handlers': ['console', 'db'], | |
}, | |
'formatters': { | |
'json': {'()': 'marrow.mongo.util.logger.JSONFormatter'}, | |
'mongo': {'()': 'marrow.mongo.util.logger.MongoFormatter'}, | |
} | |
} | |
) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from web.ext.assets import Bundle | |
from dukpy.webassets import RollupJS | |
rita_scripts = Bundle( | |
Bundle( | |
'illico.common.js:lib/babel-polyfill/dist/polyfill.js', # ES6 support | |
'illico.common.js:lib/browser-request/index.js', # HTTP request library | |
'illico.common.js:lib/sortablejs/Sortable.js', # HTML5 drag and drop support | |
'illico.rita.js:lib/delegated/index.js', # event delegation | |
'illico.rita.js:lib/medium-editor/dist/js/medium-editor.js', # WYSIWYG editor | |
'illico.rita.js:lib/medium-editor-markdown/dist/me-markdown.standalone.js', # markdown output support | |
'illico.rita.js:lib/medium-editor-list/build/medium-editor-list.js', # automatic list creation | |
output = 'third-party-%(version)s.js', | |
), | |
Bundle( | |
'illico.common.js:*.py', | |
'illico.rita.js:*.py', | |
'illico.rita:__jsmain__.py', | |
output = 'local-%(version)s.js', | |
filters = ( | |
'javascripthon', | |
RollupJS(module_entry='illico/rita/__jsmain__.py'), | |
'babeljs' if __debug__ else 'babilijs' | |
) | |
), | |
output = 'app-%(version)s.js', | |
filters = 'rjsmin', | |
) | |
rita_styles = Bundle( | |
Bundle( | |
'illico.rita.js:lib/medium-editor/dist/css/medium-editor.css', | |
output = 'third-party-%(version)s.css', | |
), | |
Bundle( | |
'illico.rita:scss/application.scss', | |
output = 'local-%(version)s.css', | |
filters = 'libsass', | |
depends = 'illico.rita:scss/**/*.scss', | |
), | |
output = 'app-%(version)s.css', | |
filters = ['autoprefixer', 'cssmin'], | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This looks like a simple enough config.