navbar current decorator
This commit is contained in:
parent
82baefb3d2
commit
2ba3fe0a7e
@ -48,7 +48,7 @@ def explore():
|
||||
next_url = url_for('explore', page=posts.next_num) if posts.has_next else None
|
||||
prev_url = url_for('explore', page=posts.prev_num) if posts.has_prev else None
|
||||
|
||||
return render_template('index.html', title='Explore', posts=posts.items, next_url=next_url, prev_url=prev_url)
|
||||
return render_template('explore.html', title='Explore', posts=posts.items, next_url=next_url, prev_url=prev_url)
|
||||
|
||||
@app.route('/login', methods=['GET', 'POST'])
|
||||
def login():
|
||||
|
@ -11,12 +11,12 @@
|
||||
<body>
|
||||
<header>
|
||||
<nav>
|
||||
<a href="{{ url_for('index') }}">home</a>
|
||||
<a href="{{ url_for('explore') }}">explore</a>
|
||||
<a {% block indexcurrent %}{% endblock %} href="{{ url_for('index') }}">home</a>
|
||||
<a {% block explorecurrent %}{% endblock %} href="{{ url_for('explore') }}">explore</a>
|
||||
{% if current_user.is_anonymous %}
|
||||
<a href="{{ url_for('login') }}">login</a>
|
||||
<a {% block logincurrent %}{% endblock %} href="{{ url_for('login') }}">login</a>
|
||||
{% else %}
|
||||
<a href="{{ url_for('user', username=current_user.username) }}">profile</a>
|
||||
<a {% block profilecurrent %}{% endblock %} href="{{ url_for('user', username=current_user.username) }}">profile</a>
|
||||
<a href="{{ url_for('logout') }}">logout</a>
|
||||
{% endif %}
|
||||
|
||||
|
29
backend/app/templates/explore.html
Normal file
29
backend/app/templates/explore.html
Normal file
@ -0,0 +1,29 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block explorecurrent %}class="current"{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Hello, {{ current_user.username }}!</h1>
|
||||
{% if form %}
|
||||
<form action="" method="post">
|
||||
{{ form.hidden_tag() }}
|
||||
<p>
|
||||
{{ form.post.label }}
|
||||
{{ form.post(cols=32, rows=4) }}
|
||||
{% for error in form.post.errors %}
|
||||
<span style="color: red;">[{{ error }}]</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>{{ form.submit() }}</p>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% for post in posts %}
|
||||
{% include '_post.html' %}
|
||||
{% endfor %}
|
||||
{% if prev_url %}<a href="{{ prev_url }}">Newer Posts</a>{% endif %}
|
||||
{% if next_url %}<a href="{{ next_url }}">Older Posts</a>{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block indexcurrent %}class="current"{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Hello, {{ current_user.username }}!</h1>
|
||||
{% if form %}
|
||||
|
@ -1,5 +1,7 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block logincurrent %}class="current"{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Sign In</h1>
|
||||
<form action="" method="post" novalidate>
|
||||
|
@ -1,5 +1,7 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block profilecurrent %}class="current"{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<table>
|
||||
<tr valign="top">
|
||||
|
@ -29,7 +29,7 @@ services:
|
||||
#tty: true
|
||||
restart: always
|
||||
# Comment following line to use flask (1worker, dev), uncomment to use uwsgi (wsgi)
|
||||
command: ["uwsgi", "--http", "0.0.0.0:8000", "--master", "-p", "4", "-w", "microblog:app"]
|
||||
#command: ["uwsgi", "--http", "0.0.0.0:8000", "--master", "-p", "4", "-w", "microblog:app"]
|
||||
environment:
|
||||
- MYSQL_USER=flasku
|
||||
#- MYSQL_PASSWORD=flaskp
|
||||
@ -92,9 +92,9 @@ services:
|
||||
proxy:
|
||||
build: proxy
|
||||
restart: always
|
||||
volumes:
|
||||
- /home/finn/d/cert/var/lib/letsencrypt:/var/lib/letsencrypt:ro
|
||||
- /home/finn/d/cert/etc/letsencrypt:/etc/letsencrypt:ro
|
||||
#volumes:
|
||||
# - /home/finn/d/cert/var/lib/letsencrypt:/var/lib/letsencrypt:ro
|
||||
# - /home/finn/d/cert/etc/letsencrypt:/etc/letsencrypt:ro
|
||||
ports:
|
||||
- 80:80
|
||||
- 443:443
|
||||
|
60
proxy/conf
60
proxy/conf
@ -1,52 +1,12 @@
|
||||
#server {
|
||||
# listen 80;
|
||||
# server_name localhost;
|
||||
# location / {
|
||||
# proxy_pass http://backend:8000;
|
||||
# }
|
||||
|
||||
|
||||
# always redirect to https
|
||||
server {
|
||||
listen 80 default_server;
|
||||
server_name _;
|
||||
return 301 https://$host$request_uri;
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
location / {
|
||||
proxy_pass http://backend:8000;
|
||||
}
|
||||
location /gutty{
|
||||
proxy_pass http://gitea:3000;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
# use the certificates
|
||||
ssl_certificate /etc/letsencrypt/live/oily.dad/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/oily.dad/privkey.pem;
|
||||
server_name oily.dad www.oily.dad;
|
||||
root /var/www/html;
|
||||
index index.php index.html index.htm;
|
||||
|
||||
|
||||
location / {
|
||||
proxy_pass http://backend:8000/;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
# use the certificates
|
||||
ssl_certificate /etc/letsencrypt/live/oily.dad/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/oily.dad/privkey.pem;
|
||||
server_name gut.oily.dad;
|
||||
root /var/www/html;
|
||||
index index.php index.html index.htm;
|
||||
|
||||
location / {
|
||||
client_max_body_size 512M;
|
||||
#proxy_pass http://localhost:3000;
|
||||
proxy_set_header Connection $http_connection;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
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;
|
||||
proxy_pass http://gitea:3000/;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user