浏览代码

readme

https
jakobsn 6 年前
父节点
当前提交
dbca1eb0ab
共有 5 个文件被更改,包括 39 次插入10 次删除
  1. +5
    -1
      README.md
  2. +2
    -0
      requirements.txt
  3. +9
    -0
      static/sql/init.sql
  4. +11
    -7
      templates/index.html
  5. +12
    -2
      vulnapp.py

+ 5
- 1
README.md 查看文件

@@ -1,8 +1,12 @@
Prerequisites

Python >= 3.5

INSTALL

pip install -r requirements.txt

RUN

gunicorn --workers=2 vulnapp
python vulnapp

+ 2
- 0
requirements.txt 查看文件

@@ -1 +1,3 @@
web.py==0.40
mysql-connector==2.2.9


+ 9
- 0
static/sql/init.sql 查看文件

@@ -0,0 +1,9 @@

create database db;

CREATE TABLE `db`.`users` (
`userid` INT NOT NULL,
`username` VARCHAR(45) NULL,
`password` VARCHAR(45) NULL,
PRIMARY KEY (`userid`));


+ 11
- 7
templates/index.html 查看文件

@@ -1,4 +1,4 @@
$def with (name)
$def with (friends)

<head>
<title>Friends</title>
@@ -12,12 +12,16 @@ $def with (name)
<h1>Friends</h1>

<img src="static/images/friends.jpeg" alt="Friends">
$if name:
<p>I just wanted to say <em>hello</em> to $name.</p>
$else:
<p><em>Hello</em>, world!</p>

<h3>Login, or become a Friend!</h3>
<h3>Login, or become a friend!</h3>

<h3>Regitered friends:</h3>
<ul>
$for name in friends:
<li id="t$name.userid">$name.username</li>
</ul>

</body>

+ 12
- 2
vulnapp.py 查看文件

@@ -5,12 +5,22 @@ urls = (
'/', 'application'
)

db = web.database(
dbn="mysql",
host='127.0.0.1',
port=3306,
user='kalle',
pw='123p',
db='db'
)

class application():

def GET(self):
name = 'Bob'
return render.index(name)
friends = db.select('users')
return render.index(friends)

if __name__ == "__main__":
app = web.application(urls, globals())
app.run()

正在加载...
取消
保存