35 lines
850 B
Python
35 lines
850 B
Python
from flask import Flask, render_template, request, redirect
|
|
from datetime import datetime
|
|
|
|
app = Flask(__name__)
|
|
|
|
def decide_ascii():
|
|
day = datetime.today().strftime('%d')
|
|
month = datetime.today().strftime('%m')
|
|
|
|
if month == "12":
|
|
return open(f'./ascii/christmas.html', 'r').read()
|
|
if month == "10":
|
|
return open(f'./ascii/halloween.html', 'r').read()
|
|
else:
|
|
return open(f'./ascii/normal.html', 'r').read()
|
|
|
|
@app.route('/')
|
|
def index():
|
|
ascii_penguin = decide_ascii()
|
|
return render_template('index.html', ascii_penguin = ascii_penguin)
|
|
|
|
@app.route('/mc')
|
|
def mc():
|
|
ascii_penguin = decide_ascii()
|
|
return render_template('mc.html', ascii_penguin = ascii_penguin)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
app.run(
|
|
debug = True,
|
|
host = "0.0.0.0",
|
|
port = 8081
|
|
)
|
|
|