mirror of
https://github.com/Tygs/0bin.git
synced 2023-08-10 21:13:00 +03:00
Added documentation, removed some options
This commit is contained in:
@@ -2,4 +2,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ai ts=4 sts=4 et sw=4
|
||||
|
||||
VERSION = __version__ = "0.1"
|
||||
from default_settings import VERSION
|
||||
|
||||
__version__ = VERSION
|
||||
@@ -7,6 +7,7 @@
|
||||
import os
|
||||
import math
|
||||
|
||||
VERSION = '0.1'
|
||||
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
LIBS_DIR = os.path.join(os.path.dirname(ROOT_DIR), 'libs')
|
||||
|
||||
@@ -25,7 +26,7 @@ STATIC_FILES_ROOT = os.path.join(ROOT_DIR, 'static')
|
||||
|
||||
# If True, will link the compressed verion of the js and css files,
|
||||
# otherwise, will use the ordinary files
|
||||
COMPRESSED_STATIC_FILES = not DEBUG
|
||||
COMPRESSED_STATIC_FILES = False
|
||||
|
||||
# absolute path where the paste files should be store
|
||||
# default in projectdirectory/static/content/
|
||||
@@ -60,7 +61,6 @@ MENU = (
|
||||
('Contact', 'mailto:your@email.com') # email
|
||||
)
|
||||
|
||||
# limit size of pasted text in bytes. Be carefull allowing too much size can slow down user's
|
||||
# browser
|
||||
# limit size of pasted text in bytes. Be carefull allowing too much size can
|
||||
# slow down user's browser
|
||||
MAX_SIZE = 1024 * 500
|
||||
MAX_SIZE_KB = int(math.ceil(MAX_SIZE / 1024.0))
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
server run.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import thread
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
@@ -104,17 +106,25 @@ def error404(code):
|
||||
return GLOBAL_CONTEXT
|
||||
|
||||
|
||||
@app.route('/static/<filename:path>')
|
||||
def server_static(filename):
|
||||
return static_file(filename, root=settings.STATIC_FILES_ROOT)
|
||||
|
||||
|
||||
@clize.clize(coerce={'debug': bool, 'compressed_static': bool})
|
||||
def runserver(host='', port='', debug=None, serve_static='', user='',
|
||||
group='', settings_file='', compressed_static=None):
|
||||
def runserver(host='', port='', debug=None, user='',
|
||||
group='', settings_file='', compressed_static=None, version=False):
|
||||
|
||||
if version:
|
||||
print '0bin V%s' % settings.VERSION
|
||||
sys.exit(0)
|
||||
|
||||
# merge the settings
|
||||
if settings_file:
|
||||
settings.update_with_file(settings_file)
|
||||
settings.update_with_file(os.path.abspath(settings_file))
|
||||
|
||||
settings.HOST = host or settings.HOST
|
||||
settings.PORT = port or settings.PORT
|
||||
settings.STATIC_FILES_ROOT = serve_static or settings.STATIC_FILES_ROOT
|
||||
settings.USER = user or settings.USER
|
||||
settings.GROUP = group or settings.GROUP
|
||||
|
||||
@@ -128,10 +138,6 @@ def runserver(host='', port='', debug=None, serve_static='', user='',
|
||||
for d in reversed(settings.TEMPLATE_DIRS):
|
||||
bottle.TEMPLATE_PATH.insert(0, d)
|
||||
|
||||
if settings.STATIC_FILES_ROOT:
|
||||
@app.route('/static/<filename:path>')
|
||||
def server_static(filename):
|
||||
return static_file(filename, root=settings.STATIC_FILES_ROOT)
|
||||
|
||||
thread.start_new_thread(drop_privileges, (settings.USER, settings.GROUP))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user