commit 8f3c6af6db733aa9d1b90f43927fc51c2ecbafb7 Author: Gyrfalcon Date: Thu May 12 17:55:49 2016 -0500 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..02de89a --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +__pycache__/ +build/ +dist/ +*.egg[-_]info/ +*.py[co] +development.* diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..f175f78 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +graft static +prune static/screenshots diff --git a/debug.py b/debug.py new file mode 100644 index 0000000..9a6924b --- /dev/null +++ b/debug.py @@ -0,0 +1,52 @@ +from __future__ import unicode_literals +import gunicorn.app.base +import getpass +import os +import webob.static +import logging + + +config = os.path.join(os.path.dirname(__file__), 'development.ini') + + +class DebugApplication(object): + + def __init__(self, app, staticpath='.'): + self.app = app + self.static = webob.static.DirectoryApp(os.path.realpath(staticpath)) + + def __call__(self, environ, start_response): + path_info = environ['PATH_INFO'].lstrip('/') + if path_info and os.path.exists(self.static.path + path_info): + return self.static(environ, start_response) + else: + return self.app(environ, start_response) + + +class Server(gunicorn.app.base.Application): + + ACCESS_LOG_FORMAT = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s"' + + def init(self, parser, opts, args): + pass + + def load_default_config(self): + super(Server, self).load_default_config() + self.cfg.set('bind', '[::]:8080') + self.cfg.set('reload', True) + self.cfg.set('workers', 1) + self.cfg.set('threads', 1) + self.cfg.set('accesslog', '-') + self.cfg.set('access_log_format', self.ACCESS_LOG_FORMAT) + self.cfg.set('timeout', 9001) + self.cfg.set('errorlog', '-') + + def load(self): + import dcow.app + app = dcow.app.Application.create(config) + return DebugApplication(app) + + +if __name__ == '__main__': + logging.basicConfig(level=logging.DEBUG) + Server().run() diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..a1d6d7f --- /dev/null +++ b/setup.py @@ -0,0 +1,13 @@ +from setuptools import find_packages, setup + +setup( + name='DarkChestOfWonders', + version='1', + description='Dark Chest of Wonders Guild Site', + author='Gyrfalcon', + author_email='gyrfalcon@darkchestofwonders.us', + url='http://darkchestofwonders.us/', + license='MIT', + packages=find_packages('src'), + package_dir={'': 'src'}, +) diff --git a/src/dcow/__init__.py b/src/dcow/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/dcow/app.py b/src/dcow/app.py new file mode 100644 index 0000000..541395c --- /dev/null +++ b/src/dcow/app.py @@ -0,0 +1,25 @@ +from milla.dispatch import routing +from . import gallery +import os +import milla.util + + +class Application(milla.Application): + + def __init__(self, config=None): + self.config = {} + if config and os.access(config, os.R_OK): + self.config.update(milla.util.read_config(config)) + self.config['milla.favicon'] = False + + self.setup_routes() + + @classmethod + def create(cls, config=None): + app = cls(config) + return app + + def setup_routes(self): + self.dispatcher = r = routing.Router() + + r.add_route('/', gallery.GalleryController()) diff --git a/src/dcow/gallery.py b/src/dcow/gallery.py new file mode 100644 index 0000000..f7f1509 --- /dev/null +++ b/src/dcow/gallery.py @@ -0,0 +1,8 @@ +import milla.controllers + + +class GalleryController(milla.controllers.HTTPVerbController): + + def GET(self, request): + response = request.ResponseClass() + return response diff --git a/static/.gitignore b/static/.gitignore new file mode 100644 index 0000000..750e145 --- /dev/null +++ b/static/.gitignore @@ -0,0 +1 @@ +screenshots/