summaryrefslogtreecommitdiff
path: root/cgi-bin
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-01-31 18:27:58 +0800
committerchai <chaifix@163.com>2018-01-31 18:27:58 +0800
commitc1803a7603135e2c148d89d5e05596f5d251842a (patch)
treeb5bc28928a317d348953eee24a0af58b603040b9 /cgi-bin
parentdc23aa78f0cf671eac2c18ee54b23e62848fac28 (diff)
修改
Diffstat (limited to 'cgi-bin')
-rw-r--r--cgi-bin/.whisper.py.un~ (renamed from cgi-bin/.page.py.swp)bin12288 -> 13233 bytes
-rw-r--r--cgi-bin/add.py0
-rw-r--r--cgi-bin/config.ini19
-rw-r--r--cgi-bin/config.py13
-rw-r--r--cgi-bin/connect.py14
-rw-r--r--cgi-bin/edit.py0
-rw-r--r--cgi-bin/page.py3
-rw-r--r--cgi-bin/path.py21
-rw-r--r--cgi-bin/template/.whisper.html.un~bin0 -> 523 bytes
-rw-r--r--cgi-bin/template/add.html0
-rw-r--r--cgi-bin/template/edit.html0
-rw-r--r--cgi-bin/template/page.html3
-rw-r--r--cgi-bin/template/style.css0
-rw-r--r--cgi-bin/template/whisper.html4
-rw-r--r--cgi-bin/whisper.py20
15 files changed, 97 insertions, 0 deletions
diff --git a/cgi-bin/.page.py.swp b/cgi-bin/.whisper.py.un~
index c0f93be..4f409c2 100644
--- a/cgi-bin/.page.py.swp
+++ b/cgi-bin/.whisper.py.un~
Binary files differ
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~
new file mode 100644
index 0000000..70eaf48
--- /dev/null
+++ b/cgi-bin/template/.whisper.html.un~
Binary files differ
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()
+
+
+