from django.shortcuts import render from django.urls import path from django.http import HttpResponse import os from datetime import datetime def decide_ascii(): day = datetime.today().strftime('%d') month = datetime.today().strftime('%m') if month == "12": return open('./ascii/christmas.html', 'r').read() if month == "10": return open('./ascii/halloween.html', 'r').read() else: return open('./ascii/normal.html', 'r').read() def index(request): ascii_penguin = decide_ascii() return render(request, 'index.html', {'ascii_penguin': ascii_penguin}) def mc(request): ascii_penguin = decide_ascii() return render(request, 'mc.html', {'ascii_penguin': ascii_penguin}) urlpatterns = [ path('', index, name='index'), path('mc', mc, name='mc'), ] # In your main file (e.g., manage.py or wsgi.py), set up the server to run. # Django handles the server running automatically. Configure your settings as needed.