Browse Source

fin-v0.1

master
wengsy 4 years ago
parent
commit
c3d5f707a6
19 changed files with 85 additions and 35 deletions
  1. +9
    -0
      APP/Dockerfile
  2. BIN
      APP/__pycache__/gunicorn.conf.cpython-36.pyc
  3. BIN
      APP/__pycache__/server.cpython-36.pyc
  4. +5
    -0
      APP/get_ip.sh
  5. +1
    -1
      APP/server.py
  6. BIN
      APP/static/img/6194337d-e732-4747-8f43-75177dbfd9da.png
  7. BIN
      APP/static/img/6905434a-9599-4820-b607-29388615bbd9.png
  8. BIN
      APP/static/img/d979b4b6-3382-4056-a2b3-b1e23001d4c8.png
  9. BIN
      APP/static/img/dc011435-10b9-4263-841f-6feb8229ea9d.png
  10. +1
    -1
      APP/static/js/ip.js
  11. +2
    -2
      APP/static/js/wsy.js
  12. +3
    -3
      APP/templates/add.html
  13. +4
    -6
      APP/templates/forget.html
  14. +2
    -4
      APP/templates/login.html
  15. +2
    -4
      APP/templates/register.html
  16. +2
    -1
      APP/templates/square.html
  17. +0
    -9
      APP/url crawler.py
  18. BIN
      APP/view/__pycache__/block.cpython-36.pyc
  19. +54
    -4
      APP/view/block.py

+ 9
- 0
APP/Dockerfile View File

@ -0,0 +1,9 @@
FROM python:3.6
WORKDIR /code
ENV FLASK_RUN_HOST 0.0.0.0
ENV FLASK_APP server.py
COPY . .
RUN pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN bash ./get_ip.sh
CMD ["flask", "run"]

BIN
APP/__pycache__/gunicorn.conf.cpython-36.pyc View File


BIN
APP/__pycache__/server.cpython-36.pyc View File


+ 5
- 0
APP/get_ip.sh View File

@ -0,0 +1,5 @@
#!/bin/bash
echo var url=\"$IP:$PORT\"; > ./static/js/ip.js

+ 1
- 1
APP/server.py View File

@ -21,5 +21,5 @@ app.register_blueprint(bp_auth)
app.register_blueprint(bp_start)
app.register_blueprint(bp_block)
app.register_blueprint(bp_collection)
init_db()
#init_db()
app.run(host="0.0.0.0",port="5000",debug=True)

BIN
APP/static/img/6194337d-e732-4747-8f43-75177dbfd9da.png View File

Before After
Width: 415  |  Height: 360  |  Size: 18 KiB

BIN
APP/static/img/6905434a-9599-4820-b607-29388615bbd9.png View File

Before After
Width: 436  |  Height: 197  |  Size: 8.2 KiB

BIN
APP/static/img/d979b4b6-3382-4056-a2b3-b1e23001d4c8.png View File

Before After
Width: 344  |  Height: 118  |  Size: 2.8 KiB

BIN
APP/static/img/dc011435-10b9-4263-841f-6feb8229ea9d.png View File

Before After
Width: 324  |  Height: 270  |  Size: 8.6 KiB

+ 1
- 1
APP/static/js/ip.js View File

@ -1 +1 @@
var url = '106.75.245.180';;
var url="106.75.245.180:5000";;

+ 2
- 2
APP/static/js/wsy.js View File

@ -23,7 +23,6 @@ var cookie = {
function sendRequest(url_suffix, data, func) {
var url = url_prefix + url_suffix;
alert(url);
$.ajax({
type: "post",
url: url,
@ -323,8 +322,9 @@ var recommend = new Vue({
},
created: function () {
var url;
url = "collection/recommend";
url = "collection/recommand";
var data = new FormData();
data.append('phonenum', phonenum);
sendRequest(url, data, function (data) {
recommend.textList = data.collections;
checkLike(this);

+ 3
- 3
APP/templates/add.html View File

@ -427,14 +427,14 @@
<ul class="vertical-nav-menu">
<li class="app-sidebar__heading">个人中心</li>
<li>
<a href="personal.html" class="mm-active">
<a href="/personal" class="mm-active">
<i class="metismenu-icon pe-7s-browser">
</i>我的集锦
</a>
</li>
<li class="app-sidebar__heading">广场</li>
<li>
<a href="square.html">
<a href="/square">
<i class="metismenu-icon pe-7s-display2">
</i>用户集锦
</a>
@ -481,7 +481,7 @@
</div>
</li>
<li class="nav-item-divider nav-item"></li>
<li class="nav-item-header nav-item" v-if="item.type!='picture' ">修改名称
<li class="nav-item-header nav-item" v-if="item.type!='picture' ">修改
</li>
<li class="nav-item" v-if="item.type!='picture' ">
<textarea autocomplete="off" v-model="item.content"

+ 4
- 6
APP/templates/forget.html View File

@ -24,19 +24,17 @@
password1: password1
},
success: function(data){
alert(data.msg);
if(data.code == 1){
window.location = "login.html";
window.location = "/login";
}
else{
window.location = "forget.html";
window.location = "/forget";
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert(XMLHttpRequest.status);
alert(XMLHttpRequest.readyState);
alert(textStatus);
window.location = "forget.html";
window.location = "/forget";
}
});
}

+ 2
- 4
APP/templates/login.html View File

@ -36,7 +36,6 @@
var phonenum = $(obj).parent().prev().prev().children("#phonenum").val();
var password = $(obj).parent().prev().children("#password").val();
var url_ = "http://"+url+":5000/bp_auth/login";
alert(url_);
$.ajax({
type: "POST",
url: url_,
@ -46,7 +45,7 @@
},
success: function (data) {
cookie.setCookie('phonenum', phonenum, 30);
alert(data.msg);
if(data.code != 1){
window.location = "%%url_for('start.login')%%";
}else{
@ -54,8 +53,7 @@
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(XMLHttpRequest.status);
alert(XMLHttpRequest.readyState);
alert(textStatus);
window.location = "%%url_for('start.login')%%";
}

+ 2
- 4
APP/templates/register.html View File

@ -33,7 +33,6 @@
var password = $(obj).parent().prev().prev().children("#password").val();
var password1 = $(obj).parent().prev().children("#password1").val();
var suf_url = ":5000/bp_auth/register";
alert(url);
var pre_url = "http://"
$.ajax({
type: "POST",
@ -45,7 +44,7 @@
password1: password1
},
success: function(data){
alert(data.msg);
if(data.code == 1){
window.location = "/login";
}
@ -55,8 +54,7 @@
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert(XMLHttpRequest.status);
alert(XMLHttpRequest.readyState);
alert(textStatus);
window.location = "/register";
}

+ 2
- 1
APP/templates/square.html View File

@ -14,6 +14,7 @@
<meta name="msapplication-tap-highlight" content="no">
<link href="../static/css/charts.css" rel="stylesheet">
<link href="../static/css/main.css" rel="stylesheet">
<script src="../static/js/ip.js"></script>
<script src="../static/js/jquery-3.5.1.min.js"></script>
<script>
// wsy
@ -432,4 +433,4 @@
<script src="../static/js/wsy.js"></script>
</body>
</html>
</html>

+ 0
- 9
APP/url crawler.py View File

@ -1,9 +0,0 @@
import requests
from bs4 import BeautifulSoup
url = "https://www.baidu.com"
html = requests.get(url)
html.encoding = 'utf-8'
soup = BeautifulSoup(html.text, "html.parser")
title = soup.find('title').text
# print(title)

BIN
APP/view/__pycache__/block.cpython-36.pyc View File


+ 54
- 4
APP/view/block.py View File

@ -175,10 +175,60 @@ def edit():
def get_web_name():
url = request.form.get('url')
ret = {'msg': 'succuss'}
html = requests.get(url)
html.encoding = 'utf-8'
soup = BeautifulSoup(html.text, "html.parser")
title = soup.find('title').text
ori_url = url
title = None
if ori_url[0:4] != "http":
url = "https://" + ori_url
try:
html = requests.get(url)
except:
url = "http://" + ori_url
try:
html = requests.get(url)
except:
title = None
else:
soup = BeautifulSoup(html.text, "html.parser")
coding = soup.find('meta', attrs={'http-equiv': 'Content-Type'})
if coding != None:
coding = coding['content']
if 'charset' in coding:
html.encoding = coding[coding.find('charset')+len('charset='):]
else:
html.encoding = 'utf-8'
else:
coding = soup.find('meta', attrs={'http-equiv': 'content-type'})
if coding != None:
coding = coding['content']
if 'charset' in coding:
html.encoding = coding[coding.find('charset')+len('charset='):]
else:
html.encoding = 'utf-8'
else:
html.encoding = 'utf-8'
soup = BeautifulSoup(html.text, "html.parser")
title = soup.find('title').text
else:
soup = BeautifulSoup(html.text, "html.parser")
coding = soup.find('meta', attrs={'http-equiv': 'Content-Type'})
if coding != None:
coding = coding['content']
if 'charset' in coding:
html.encoding = coding[coding.find('charset')+len('charset='):]
else:
html.encoding = 'utf-8'
else:
coding = soup.find('meta', attrs={'http-equiv': 'content-type'})
if coding != None:
coding = coding['content']
if 'charset' in coding:
html.encoding = coding[coding.find('charset')+len('charset='):]
else:
html.encoding = 'utf-8'
else:
html.encoding = 'utf-8'
soup = BeautifulSoup(html.text, "html.parser")
title = soup.find('title').text
"""
ret['name'] = url对应的网站的titleurl
"""

Loading…
Cancel
Save