This file contains 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 | |
app = Flask(__name__) | |
@app.route("/") | |
def hello(): | |
return "Hello World!" | |
if __name__ == "__main__": | |
app.run(debug=True) |
This file contains 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 PUBLIC "-//W3C//DTD HTML 4.01//EN"> | |
<html lang="en"> | |
<head> <title>My Webpage</title> </head> | |
<body> | |
<ul id="navigation"> | |
{% for item in navigation %} | |
<li><a href="{{ item.href }}">{{ item.caption }}</a></li> | |
{% endfor %} | |
</ul> | |
<h1>My Webpage</h1> {{ a_variable }} |
This file contains 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 sqlalchemy import create_engine | |
engine = create_engine('sqlite:///:memory:', echo=True) |
This file contains 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
class User(Base): | |
__tablename__ = 'users' | |
id = Column(Integer, primary_key=True) | |
username = Column(String(100), unique=True) | |
password = Column(String(100)) | |
firstName = Column(String(100)) | |
middleNames = Column(String(100)) |
This file contains 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
@app.route('/add', methods=['POST']) | |
def add_entry(): | |
if not session.get('logged_in'): | |
abort(401) | |
database_session.add( Item( "some data here" ) ) | |
database_session.commit() | |
flash('New entry was successfully posted') | |
return redirect(url_for('show_entries')) |
This file contains 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
### Keybase proof | |
I hereby claim: | |
* I am rayhaanj on github. | |
* I am rayhaan (https://keybase.io/rayhaan) on keybase. | |
* I have a public key whose fingerprint is 5A65 1824 89C2 EDBF 5343 09E7 E1F3 C1BC 5B1A FE13 | |
To claim this, I am signing this object: |