This repository has been archived by the owner on Jul 7, 2023. It is now read-only.
/
main.py
executable file
·72 lines (50 loc) · 1.69 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# main.py
# Copyright 2011 by Dominic Miglar
from bottle import route, run, debug, static_file, redirect, request
from bottle import jinja2_template as template
import os
from pictureget import getit
from thumber import thumber
from functions import logToFile
from del_checker import del_checker
from image_scaler import img_scaler
from config import web_header, web_footer, web_title
from config import THUMBpictureDir, pictureDir, logFile
# Der Mainpath der Webseite
# Wenn man den Inhalt '/' aufruft, wird man autom. auf diese Route verwiesen
mainpath = '/main'
@route('/')
def start():
redirect(mainpath)
@route('/main')
def mainpage():
logToFile(logFile, 'bottle:\t\tClient connecting from '+str(request['REMOTE_ADDR']))
content = 'lorem ipsum blablablablabla'
thumber()
del_checker()
img_scaler()
thumbs = getit(THUMBpictureDir)
return template('child', mytitle=web_title, myheader=web_header, mycontent=content, myfooter=web_footer, thumbDir=THUMBpictureDir, picDir=pictureDir, thumbs=thumbs)
# STATIC ROUTES - BEGIN
@route('/styles/:style')
def static_style(style):
return static_file(style, root='styles')
@route('/pictures/:picture')
def static_picture(picture):
return static_file(picture, root='pictures')
@route('/pictures/thumbs/:thumb')
def static_thumb(thumb):
return static_file(thumb, root='pictures/thumbs')
@route('/favicon.ico')
def favicon_static():
return static_file('favicon.ico', root='static_stuff')
@route('/js/:path#.+#')
def js_static(path):
return static_file(path, root='js')
# STATIC ROUTES - END
# Debug Mode
debug(True)
# Servermuhbla
run(host="0.0.0.0", port=8080)