Skip to content

Instantly share code, notes, and snippets.

@DanielTimLee
Last active December 11, 2017 04:02
Show Gist options
  • Save DanielTimLee/48877527d255fd6ff907aa6c17379da9 to your computer and use it in GitHub Desktop.
Save DanielTimLee/48877527d255fd6ff907aa6c17379da9 to your computer and use it in GitHub Desktop.
Boilerplate
from flask import Flask, redirect, url_for
app = Flask(__name__)
head = '''
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css">
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
</head>
<body>
<main>
<div style="height:40vh"></div>
<div class="section">
<div class="container">
<div class="row center">
<div class="container">
<div class="blue lighten-5 card-panel pulse">
<div class="card-content">
'''
tail = '''
<div>
<div>
</div>
<div>
</div>
</div>
</main>
</body>
'''
@app.route('/')
def index():
return redirect(url_for('hi'))
@app.route('/v1/yourAPI/hi')
def hi():
return head+'''<h5>Hola, v1 API From Your-API.com .</h5>'''
if __name__ == '__main__':
app.run(port=9000,host='0.0.0.0')
body {
display: flex;
min-height: 100vh;
flex-direction: column;
}
main {
flex: 1 0 auto;
}
<!DOCTYPE html>
<html>
<body>
<form action="/action_page.php">
First name:<br>
<input type="text" name="firstname" value="Mickey">
<br>
Last name:<br>
<input type="text" name="lastname" value="Mouse">
<br><br>
<input type="submit" value="Submit">
</form>
<p>If you click the "Submit" button, the form-data will be sent to a page called "/action_page.php".</p>
</body>
</html>
# From Kindly Help
# https://coderwall.com/p/habdwg/speed-up-package-download-in-vagrant-boxes
config.vm.provision :shell, :inline => "sed -i 's/us.archive/de.archive/g' /etc/apt/sources.list"
config.vm.provision "shell", inline: "apt-get update -y"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment