flask
This commit is contained in:
parent
3bc3b34c67
commit
47af2ede1c
4
app.py
4
app.py
|
|
@ -3,8 +3,8 @@ import json
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
@app.post('/api/message')
|
@app.post('/_/message')
|
||||||
def message():
|
def message():
|
||||||
with open('message.txt', 'a') as f:
|
with open('message.txt', 'a') as f:
|
||||||
f.write(json.dumps(request.form))
|
f.write(json.dumps(request.form))
|
||||||
return redirect('http://localhost:8080')
|
return redirect('/contact')
|
||||||
|
|
|
||||||
10
nginx.conf
10
nginx.conf
|
|
@ -16,10 +16,18 @@ http {
|
||||||
try_files $uri $uri.html $uri/ =404;
|
try_files $uri $uri.html $uri/ =404;
|
||||||
autoindex on;
|
autoindex on;
|
||||||
types {
|
types {
|
||||||
text/html html htm shtml;
|
text/html html;
|
||||||
text/css css;
|
text/css css;
|
||||||
application/javascript js;
|
application/javascript js;
|
||||||
|
image/x-icon ico;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
location /_/ {
|
||||||
|
proxy_pass http://127.0.0.1:5000;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ title: message
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="panel f">
|
<div class="panel f">
|
||||||
<h2>contact</h2>
|
<h2>contact</h2>
|
||||||
<form method="post" action="/api/message">
|
<form method="post" action="/_/message">
|
||||||
<label><input type="text" name="name" value="" required>name</label>
|
<label><input type="text" name="name" value="" required>name</label>
|
||||||
<label><input type="text" name="email" value="">email / other contact info</label>
|
<label><input type="text" name="email" value="">email / other contact info</label>
|
||||||
<br>
|
<br>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue