summaryrefslogtreecommitdiff
path: root/path.py
diff options
context:
space:
mode:
Diffstat (limited to 'path.py')
-rw-r--r--path.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/path.py b/path.py
new file mode 100644
index 0000000..e0a49b8
--- /dev/null
+++ b/path.py
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+import config
+from config import Config
+
+root = Config.get("route", "url")
+imgsDir = Config.get("route", "images")
+templDir = Config.get("route", "templates")
+disk = Config.get("route", "disk")
+
+class Path(object):
+ # 拼接url
+ def url(path):
+ return root + '/' + path
+
+ # 图片url
+ def img(imgFile):
+ return root + imgsDir + '/' + imgFile
+
+ # 图片硬盘路径
+ def imgpath(imgFile):
+ return disk + imgsDir + '/' + imgFile
+
+ # html模板硬盘路径
+ def template(templ):
+ return templDir + '/' + templ
+