forked from MarseyWorld/MarseyWorld
fdsfdsfds
parent
7ae88fd99e
commit
799fb8f9c9
|
@ -3,7 +3,6 @@ gevent.monkey.patch_all()
|
||||||
from os import environ
|
from os import environ
|
||||||
import secrets
|
import secrets
|
||||||
from flask import *
|
from flask import *
|
||||||
from flask_assets import Bundle, Environment
|
|
||||||
from flask_caching import Cache
|
from flask_caching import Cache
|
||||||
from flask_limiter import Limiter
|
from flask_limiter import Limiter
|
||||||
from flask_compress import Compress
|
from flask_compress import Compress
|
||||||
|
@ -89,13 +88,6 @@ cache = Cache(app)
|
||||||
Compress(app)
|
Compress(app)
|
||||||
mail = Mail(app)
|
mail = Mail(app)
|
||||||
|
|
||||||
assets = Environment(app)
|
|
||||||
css = Bundle('src/main.css', output='dist/main.css', filters='postcss')
|
|
||||||
|
|
||||||
assets.register('css', css)
|
|
||||||
css.build()
|
|
||||||
|
|
||||||
|
|
||||||
@app.before_request
|
@app.before_request
|
||||||
def before_request():
|
def before_request():
|
||||||
|
|
||||||
|
|
|
@ -247,6 +247,20 @@ def archives(path):
|
||||||
if request.path.endswith('.css'): resp.headers.add("Content-Type", "text/css")
|
if request.path.endswith('.css'): resp.headers.add("Content-Type", "text/css")
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
|
@app.get('/static/<path:path>')
|
||||||
|
@limiter.exempt
|
||||||
|
def static_service(path):
|
||||||
|
resp = make_response(send_from_directory('./static', path))
|
||||||
|
if request.path.endswith('.webp') or request.path.endswith('.gif') or request.path.endswith('.ttf') or request.path.endswith('.woff') or request.path.endswith('.woff2'):
|
||||||
|
resp.headers.remove("Cache-Control")
|
||||||
|
resp.headers.add("Cache-Control", "public, max-age=2628000")
|
||||||
|
|
||||||
|
if request.path.endswith('.webp'):
|
||||||
|
resp.headers.remove("Content-Type")
|
||||||
|
resp.headers.add("Content-Type", "image/webp")
|
||||||
|
|
||||||
|
return resp
|
||||||
|
|
||||||
@app.get('/assets/<path:path>')
|
@app.get('/assets/<path:path>')
|
||||||
@limiter.exempt
|
@limiter.exempt
|
||||||
def static_service(path):
|
def static_service(path):
|
||||||
|
|
|
@ -188,9 +188,7 @@
|
||||||
|
|
||||||
<link rel="stylesheet" href="/assets/css/main.css?v=203">
|
<link rel="stylesheet" href="/assets/css/main.css?v=203">
|
||||||
|
|
||||||
{% assets 'css' %}
|
<link rel="stylesheet" href="/static/dist.css">
|
||||||
<link rel="stylesheet" href="{{ ASSET_URL }}">
|
|
||||||
{% endassets %}
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="/assets/css/mistletoe.css?v=200">
|
<link rel="stylesheet" href="/assets/css/mistletoe.css?v=200">
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,7 @@
|
||||||
|
|
||||||
<link rel="stylesheet" href="/assets/css/main.css?v=200">
|
<link rel="stylesheet" href="/assets/css/main.css?v=200">
|
||||||
|
|
||||||
{% assets 'css' %}
|
<link rel="stylesheet" href="/static/dist.css">
|
||||||
<link rel="stylesheet" href="{{ ASSET_URL }}">
|
|
||||||
{% endassets %}
|
|
||||||
|
|
||||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,7 @@
|
||||||
|
|
||||||
<link rel="stylesheet" href="/assets/css/main.css?v=200">
|
<link rel="stylesheet" href="/assets/css/main.css?v=200">
|
||||||
|
|
||||||
{% assets 'css' %}
|
<link rel="stylesheet" href="/static/dist.css">
|
||||||
<link rel="stylesheet" href="{{ ASSET_URL }}">
|
|
||||||
{% endassets %}
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="/assets/css/mistletoe.css?v=200">
|
<link rel="stylesheet" href="/assets/css/mistletoe.css?v=200">
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,7 @@
|
||||||
|
|
||||||
<link rel="stylesheet" href="/assets/css/main.css?v=200">
|
<link rel="stylesheet" href="/assets/css/main.css?v=200">
|
||||||
|
|
||||||
{% assets 'css' %}
|
<link rel="stylesheet" href="/static/dist.css">
|
||||||
<link rel="stylesheet" href="{{ ASSET_URL }}">
|
|
||||||
{% endassets %}
|
|
||||||
|
|
||||||
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,7 @@
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
{% assets 'css' %}
|
<link rel="stylesheet" href="/static/dist.css">
|
||||||
<link rel="stylesheet" href="{{ ASSET_URL }}">
|
|
||||||
{% endassets %}
|
|
||||||
|
|
||||||
<title>Flask + Tailwind CSS</title>
|
<title>Flask + Tailwind CSS</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
Loading…
Reference in New Issue