diff options
Diffstat (limited to 'cgi-bin')
-rw-r--r-- | cgi-bin/.whisper.py.un~ (renamed from cgi-bin/.page.py.swp) | bin | 12288 -> 13233 bytes | |||
-rw-r--r-- | cgi-bin/add.py | 0 | ||||
-rw-r--r-- | cgi-bin/config.ini | 19 | ||||
-rw-r--r-- | cgi-bin/config.py | 13 | ||||
-rw-r--r-- | cgi-bin/connect.py | 14 | ||||
-rw-r--r-- | cgi-bin/edit.py | 0 | ||||
-rw-r--r-- | cgi-bin/page.py | 3 | ||||
-rw-r--r-- | cgi-bin/path.py | 21 | ||||
-rw-r--r-- | cgi-bin/template/.whisper.html.un~ | bin | 0 -> 523 bytes | |||
-rw-r--r-- | cgi-bin/template/add.html | 0 | ||||
-rw-r--r-- | cgi-bin/template/edit.html | 0 | ||||
-rw-r--r-- | cgi-bin/template/page.html | 3 | ||||
-rw-r--r-- | cgi-bin/template/style.css | 0 | ||||
-rw-r--r-- | cgi-bin/template/whisper.html | 4 | ||||
-rw-r--r-- | cgi-bin/whisper.py | 20 |
15 files changed, 97 insertions, 0 deletions
diff --git a/cgi-bin/.page.py.swp b/cgi-bin/.whisper.py.un~ Binary files differindex c0f93be..4f409c2 100644 --- a/cgi-bin/.page.py.swp +++ b/cgi-bin/.whisper.py.un~ diff --git a/cgi-bin/add.py b/cgi-bin/add.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/cgi-bin/add.py diff --git a/cgi-bin/config.ini b/cgi-bin/config.ini new file mode 100644 index 0000000..b246c3b --- /dev/null +++ b/cgi-bin/config.ini @@ -0,0 +1,19 @@ +[route] +#需要配置apache +#根路由 +url="/chai/whisper/" +#静态根目录 +static_root="/html/" +imgs_dir="/html/imgs/" +#html模板目录 +templ_dir="template/" +[database] +user="root" +passwd="root" +host="localhost" +port=3306 +database="whisper" +[config] +#每页显示whisper条数 +whisper_count=10 + diff --git a/cgi-bin/config.py b/cgi-bin/config.py new file mode 100644 index 0000000..f9ee2f6 --- /dev/null +++ b/cgi-bin/config.py @@ -0,0 +1,13 @@ +# parse config.ini +# -*- coding: utf-8 -*- +import configparser, codecs, sys + +conf = configparser.ConfigParser() +conf.read("config.ini") + +class Config(object): + @classmethod + def get(cls, section, option): + return conf.get(section, option) + + diff --git a/cgi-bin/connect.py b/cgi-bin/connect.py new file mode 100644 index 0000000..c027978 --- /dev/null +++ b/cgi-bin/connect.py @@ -0,0 +1,14 @@ +import pymysql +import config +from config import Config + +host = Config.get("database", "host") +port = Config.get("database", "port") +user = Config.get("database", "user") +passwd = Config.get("database", "passwd") +db = Config.get("database", "database") + +class Connect(object): + def produce(): + return pymysql.connect(host, user, passwd, db) + diff --git a/cgi-bin/edit.py b/cgi-bin/edit.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/cgi-bin/edit.py diff --git a/cgi-bin/page.py b/cgi-bin/page.py index e69de29..b28b04f 100644 --- a/cgi-bin/page.py +++ b/cgi-bin/page.py @@ -0,0 +1,3 @@ + + + diff --git a/cgi-bin/path.py b/cgi-bin/path.py new file mode 100644 index 0000000..ac1ed5a --- /dev/null +++ b/cgi-bin/path.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +import config +from config import Config + +root = Config.get("route", "url") +imgsDir = Config.get("route", "imgs_dir") +templDir = Config.get("route", "templ_dir") + +class Path(object): + # 拼接url + def url(path): + return root + path + + # 保存的图片路径 + def img(imgFile): + return root + imgsDir + imgFile + + # html模板路径 + def template(templ): + return templDir + templ + diff --git a/cgi-bin/template/.whisper.html.un~ b/cgi-bin/template/.whisper.html.un~ Binary files differnew file mode 100644 index 0000000..70eaf48 --- /dev/null +++ b/cgi-bin/template/.whisper.html.un~ diff --git a/cgi-bin/template/add.html b/cgi-bin/template/add.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/cgi-bin/template/add.html diff --git a/cgi-bin/template/edit.html b/cgi-bin/template/edit.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/cgi-bin/template/edit.html diff --git a/cgi-bin/template/page.html b/cgi-bin/template/page.html index e69de29..b28b04f 100644 --- a/cgi-bin/template/page.html +++ b/cgi-bin/template/page.html @@ -0,0 +1,3 @@ + + + diff --git a/cgi-bin/template/style.css b/cgi-bin/template/style.css new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/cgi-bin/template/style.css diff --git a/cgi-bin/template/whisper.html b/cgi-bin/template/whisper.html new file mode 100644 index 0000000..fd40910 --- /dev/null +++ b/cgi-bin/template/whisper.html @@ -0,0 +1,4 @@ + + + + diff --git a/cgi-bin/whisper.py b/cgi-bin/whisper.py new file mode 100644 index 0000000..0372b03 --- /dev/null +++ b/cgi-bin/whisper.py @@ -0,0 +1,20 @@ +import path +from path import Path +import connect +from connect import Connect + +class Whisper(object): + def build(whisperId): + conn = Connect.produce() + cursor = conn.cursor() + + whisper_file = open(Path.template("whisper.html"), 'r', encoding="utf8") + whisper_templ = whisper_file.read() + whisper_file.close() + + + + conn.close() + + + |