瀏覽代碼

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 INSTALL


pip install -r requirements.txt pip install -r requirements.txt


RUN RUN


gunicorn --workers=2 vulnapp
python vulnapp

+ 2
- 0
requirements.txt 查看文件

@@ -1 +1,3 @@
web.py==0.40 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> <head>
<title>Friends</title> <title>Friends</title>
@@ -12,12 +12,16 @@ $def with (name)
<h1>Friends</h1> <h1>Friends</h1>


<img src="static/images/friends.jpeg" alt="Friends"> <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> </body>

+ 12
- 2
vulnapp.py 查看文件

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


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

class application(): class application():


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

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

Loading…
取消
儲存