Skip to content

Instantly share code, notes, and snippets.

View vihar's full-sized avatar
🚀

Vihar Kurama vihar

🚀
View GitHub Profile
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://localhost/appdb'
db = SQLAlchemy(app)
migrate = Migrate(app, db)
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://localhost/testdb'
db = SQLAlchemy(app)
class Post(db.Model):
id = db.Column(db.Integer(), primary_key=True)
from flask import Flask, request, render_template
from flask_sqlalchemy import SQLAlchemy
# Settings
app = Flask(__name__)
app.config['DEBUG'] = True
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://localhost/appdb'
db = SQLAlchemy(app)
@app.route('/')
from flask import Flask, render_template, request, url_for, redirect
app = Flask(__name__)
@app.route('/')
def hello_there():
return 'Hello there!'
@app.route('/form', methods=['POST', 'GET'])
<!DOCTYPE html>
<html>
<head>
<title>Bio-Data Details</title>
</head>
<body>
<h1>Bio-Data Details</h1>
<hr>
<h1>Username: {{ username }}</h1>
<h1>Email: {{ email }}</h1>
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<h1>Bio Data Form</h1>
<form action="showbio">
<label>Username</label>
<input type="name" name="username"><br>
from flask import Flask, render_template, request, url_for, redirect
app = Flask(__name__)
@app.route('/')
def hello_there():
return 'Hello there!'
@app.route('/form', methods=['POST', 'GET'])
<!DOCTYPE html>
<html>
<head>
<title>Bio-Data</title>
</head>
<body>
<form action="showbio">
<input type="text" name="username" placeholder="Your Name"/>
<input type="text" name="age" placeholder="Your Age"/>
<input type="text" name="email" placeholder="Your Mail ID"/>
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
if __name__ =="__main__":
app.run(debug=True,port=8080)
# Importing Modules
from sklearn.datasets import load_iris
import matplotlib.pyplot as plt
from sklearn.cluster import DBSCAN
from sklearn.decomposition import PCA
# Load Dataset
iris = load_iris()
# Declaring Model