21
loading...
This website collects cookies to deliver better user experience
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route('/register', methods = ["GET", "POST"])
def register():
if request.method == "POST":
username = request.form["username"]
email = request.form["email"]
password = request.form["password"]
return render_template('register.html')
if __name__ == '__main__':
app.run(debug=True)
<html>
<head>
<title>Welcome to our registration page</title>
</head>
<body>
<form>
Username <input type = "text" name= "username" />
Email <input type = "text" name = "email" />
Password <input type = "text" name = "password" />
</form>
</body>
</html>
FROM python:3.6-alpine
COPY . app
COPY ./requirements.txt /app/requirements.txt
WORKDIR app
EXPOSE 5000:5000
RUN pip install -r requirements.txt
CMD [ "python", "server.py" ]
>>> docker build -t myimage .
docker run
command, the following command will run our myimage image.>>>docker run -t -i myimage
docker-compose up
to build and run our docker container and docker-compose down
to stop the container.