Made a flask server thing, gonna port it to django though ig.
This commit is contained in:
34
main.py
Normal file
34
main.py
Normal file
@@ -0,0 +1,34 @@
|
||||
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
|
||||
)
|
||||
|
Reference in New Issue
Block a user