This repository has been archived on 2023-10-01. You can view files and clone it, but cannot push or open issues or pull requests.
PyNyaaTa/pynyaata/__init__.py

39 lines
739 B
Python
Raw Normal View History

2023-01-01 23:44:48 +00:00
from datetime import datetime
2023-01-01 11:13:32 +00:00
from secrets import token_hex
from flask import Flask, render_template
from pynyaata.forms import SearchForm
from pynyaata.translations import current_lang, i18n
app = Flask(__name__)
app.config["SECRET_KEY"] = token_hex()
@app.context_processor
def utility_processor():
2023-01-01 23:44:48 +00:00
current_date = datetime.now()
next_year = current_date.year + 5 - (current_date.year % 5)
print(next_year)
2023-01-01 11:13:32 +00:00
return dict(_=i18n, current_lang=current_lang(), search_form=SearchForm())
@app.route("/")
def index():
return render_template("index.html.j2")
@app.route("/search")
def search():
return render_template("search.html.j2")
2022-12-22 00:01:21 +00:00
def run():
2023-01-01 11:13:32 +00:00
app.run("0.0.0.0")
if __name__ == "__main__":
run()