.
This commit is contained in:
19
Pipenv
19
Pipenv
@@ -1,19 +0,0 @@
|
|||||||
[[source]]
|
|
||||||
url = "https://pypi.org/simple"
|
|
||||||
verify_ssl = true
|
|
||||||
name = "pypi"
|
|
||||||
|
|
||||||
[packages]
|
|
||||||
flask = "*"
|
|
||||||
|
|
||||||
[dev-packages]
|
|
||||||
pylint = "*"
|
|
||||||
flake8 = "*"
|
|
||||||
yapf = "*"
|
|
||||||
black = "*"
|
|
||||||
|
|
||||||
[requires]
|
|
||||||
python_version = "3.8"
|
|
||||||
|
|
||||||
[pipenv]
|
|
||||||
allow_prereleases = true
|
|
||||||
2
Pipfile
2
Pipfile
@@ -5,6 +5,8 @@ name = "pypi"
|
|||||||
|
|
||||||
[packages]
|
[packages]
|
||||||
flask = "*"
|
flask = "*"
|
||||||
|
flask_wtf = "*"
|
||||||
|
flask-login = "*"
|
||||||
|
|
||||||
[dev-packages]
|
[dev-packages]
|
||||||
pylint = "*"
|
pylint = "*"
|
||||||
|
|||||||
25
Pipfile.lock
generated
25
Pipfile.lock
generated
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"hash": {
|
"hash": {
|
||||||
"sha256": "52e9358ee91840925689af9f58eeb06f9ed43e59d78d635179330809c6a53afa"
|
"sha256": "6f468a10e748aa502127b19811e3cb91bc60a239cbe1c6fa7cc3d0a90dc9ab30"
|
||||||
},
|
},
|
||||||
"pipfile-spec": 6,
|
"pipfile-spec": 6,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -31,6 +31,22 @@
|
|||||||
"index": "pypi",
|
"index": "pypi",
|
||||||
"version": "==2.0.1"
|
"version": "==2.0.1"
|
||||||
},
|
},
|
||||||
|
"flask-login": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:6d33aef15b5bcead780acc339464aae8a6e28f13c90d8b1cf9de8b549d1c0b4b",
|
||||||
|
"sha256:7451b5001e17837ba58945aead261ba425fdf7b4f0448777e597ddab39f4fba0"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==0.5.0"
|
||||||
|
},
|
||||||
|
"flask-wtf": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:6ff7af73458f182180906a37a783e290bdc8a3817fe4ad17227563137ca285bf",
|
||||||
|
"sha256:ff177185f891302dc253437fe63081e7a46a4e99aca61dfe086fb23e54fff2dc"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==0.15.1"
|
||||||
|
},
|
||||||
"itsdangerous": {
|
"itsdangerous": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:5174094b9637652bdb841a3029700391451bd092ba3db90600dea710ba28e97c",
|
"sha256:5174094b9637652bdb841a3029700391451bd092ba3db90600dea710ba28e97c",
|
||||||
@@ -90,6 +106,13 @@
|
|||||||
"sha256:6c1ec500dcdba0baa27600f6a22f6333d8b662d22027ff9f6202e3367413caa8"
|
"sha256:6c1ec500dcdba0baa27600f6a22f6333d8b662d22027ff9f6202e3367413caa8"
|
||||||
],
|
],
|
||||||
"version": "==2.0.1"
|
"version": "==2.0.1"
|
||||||
|
},
|
||||||
|
"wtforms": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:7ee6e0591777e4ad6779276cd64464bd0a8fc1ce2509b5bb88f936c9426c180c",
|
||||||
|
"sha256:cf01f0173ff7124ab30afeee444876a0f576fa5ed9c32f2112c439137077492f"
|
||||||
|
],
|
||||||
|
"version": "==3.0.0a1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"develop": {
|
"develop": {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
from flask import Flask
|
from flask import Flask
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
app.config["SECRET_KEY"] = "fdsaGHJ768fdsGHKJHG656&*(&%&*(fsd"
|
||||||
|
|
||||||
from app import routes
|
from app import routes
|
||||||
|
|||||||
10
app/forms.py
Normal file
10
app/forms.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
from flask_wtf import FlaskForm
|
||||||
|
from wtforms import StringField, PasswordField, BooleanField, SubmitField
|
||||||
|
from wtforms.validators import DataRequired
|
||||||
|
|
||||||
|
|
||||||
|
class LoginForm(FlaskForm):
|
||||||
|
username = StringField("Username", validators=[DataRequired()])
|
||||||
|
password = PasswordField("Password", validators=[DataRequired()])
|
||||||
|
remember_me = BooleanField("Remember Me")
|
||||||
|
submit = SubmitField("Sign In")
|
||||||
@@ -1,7 +1,13 @@
|
|||||||
|
from flask import render_template
|
||||||
from app import app
|
from app import app
|
||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
@app.route("/index")
|
@app.route("/index")
|
||||||
def index():
|
def index():
|
||||||
return "Hello, World!"
|
user = {"username": "Miguel"}
|
||||||
|
posts = [
|
||||||
|
{"author": {"username": "John"}, "body": "Beautiful day in Portland!"},
|
||||||
|
{"author": {"username": "Susan"}, "body": "The Avengers movie was so cool!"},
|
||||||
|
]
|
||||||
|
return render_template("index.html", title="Home", user=user, posts=posts)
|
||||||
|
|||||||
20
app/templates/index.html
Normal file
20
app/templates/index.html
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
{% if title %}
|
||||||
|
<title>{{ title }} - Microblog</title>
|
||||||
|
{% else %}
|
||||||
|
<title>Welcome to Microblog</title>
|
||||||
|
{% endif %}
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>Hi, {{ user.username }}!</h1>
|
||||||
|
{% for post in posts %}
|
||||||
|
<div>
|
||||||
|
<p>{{ post.author.username }} says: <b>{{ post.body }}</b></p>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user