Initial commit

remotes/origin/HEAD
Gyrfalcon 2016-05-12 17:55:49 -05:00
commit 8f3c6af6db
8 changed files with 107 additions and 0 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
__pycache__/
build/
dist/
*.egg[-_]info/
*.py[co]
development.*

2
MANIFEST.in Normal file
View File

@ -0,0 +1,2 @@
graft static
prune static/screenshots

52
debug.py Normal file
View File

@ -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()

13
setup.py Normal file
View File

@ -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
src/dcow/__init__.py Normal file
View File

25
src/dcow/app.py Normal file
View File

@ -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())

8
src/dcow/gallery.py Normal file
View File

@ -0,0 +1,8 @@
import milla.controllers
class GalleryController(milla.controllers.HTTPVerbController):
def GET(self, request):
response = request.ResponseClass()
return response

1
static/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
screenshots/