Initial commit
commit
8f3c6af6db
|
@ -0,0 +1,6 @@
|
|||
__pycache__/
|
||||
build/
|
||||
dist/
|
||||
*.egg[-_]info/
|
||||
*.py[co]
|
||||
development.*
|
|
@ -0,0 +1,2 @@
|
|||
graft static
|
||||
prune static/screenshots
|
|
@ -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()
|
|
@ -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'},
|
||||
)
|
|
@ -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())
|
|
@ -0,0 +1,8 @@
|
|||
import milla.controllers
|
||||
|
||||
|
||||
class GalleryController(milla.controllers.HTTPVerbController):
|
||||
|
||||
def GET(self, request):
|
||||
response = request.ResponseClass()
|
||||
return response
|
|
@ -0,0 +1 @@
|
|||
screenshots/
|
Loading…
Reference in New Issue