Created
April 17, 2021 10:29
-
-
Save shinysu/b5277aa10136aa6951f4392f3042b367 to your computer and use it in GitHub Desktop.
todolist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, render_template | |
app = Flask( | |
__name__, | |
template_folder = 'client/templates' | |
) | |
@app.route('/') | |
def index(): | |
return render_template('index.html') | |
if __name__ == '__main__': | |
app.run(debug=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlite3 | |
sql_query = """ | |
CREATE TABLE IF NOT EXISTS Todo( | |
id INTEGER PRIMARY KEY, | |
task TEXT, | |
complete boolean | |
); | |
""" | |
def execute_query(sql_query): | |
with sqlite3.connect("todo.db") as conn: | |
cur = conn.cursor() | |
result = cur.execute(sql_query) | |
conn.commit() | |
return result | |
if __name__ == '__main__': | |
execute_query(sql_query) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>TodoList</title> | |
</head> | |
<body> | |
<h1> ToDo List</h1> | |
<form> | |
<label>Add a new item </label> | |
<input type="text" name="todoitem"> | |
<input type="submit" > | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment