Skip to content

Instantly share code, notes, and snippets.

@cedbeu
cedbeu / webapp.py
Created May 17, 2013 00:25
Minimal Flask application - Basic single-file design pattern
#!/usr/bin/python
# coding: utf-8
from flask import Flask
app = Flask(__name__)
@app.route('/')
def entry_point():
return 'Hello World!'
@cedbeu
cedbeu / __init__.py
Last active April 16, 2019 00:11
Minimal Flask application - Basic package design pattern Create a structure like this: `./run.py` `./webapp/__init__.py` `./webapp/views.py`
#!/usr/bin/python
# coding: utf-8
""" Filename: __init__.py
Purpose: This file is required to structure the web service as a
package, to be able to define routes in multiple modules.
This is the most basic design pattern for multiple files
Flask apps: http://flask.pocoo.org/docs/patterns/packages/
Requirements:
Author: Cédric Beuzit
"""
@cedbeu
cedbeu / js_console_load_jquery.js
Last active December 17, 2015 09:19
Make the latest jQuery available in the browser's javascript console
var script = document.createElement('script');
script.src = "http://code.jquery.com/jquery-latest.min.js";
document.getElementsByTagName('head')[0].appendChild(script);
jQuery.noConflict();