Skip to content

Commit

Permalink
Added PSQL support
Browse files Browse the repository at this point in the history
  • Loading branch information
Zachary Hanif committed Nov 7, 2019
1 parent 739a042 commit 5defef2
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/server.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
from flask import Flask


from flask.ext.sqlalchemy import SQLAlchemy
import os

app = Flask(__name__)

POSTGRES_USER = "818_user"
POSTGRES_PW = "818"
POSTGRES_URL = "127.0.0.1:5432"
POSTGRES_DB = "project"

DB_URL = 'postgresql+psycopg2://{user}:{pw}@{url}/{db}'.format(user=POSTGRES_USER,pw=POSTGRES_PW,url=POSTGRES_URL,db=POSTGRES_DB)

app.config['SQLALCHEMY_DATABASE_URI'] = DB_URL

db = SQLAlchemy(app)

class Experiment(db.Model):
id = db.Column(db.Integer, primary_key=True)
experiment_data = db.Column(db.String(200), unique=False, nullable=True)

@app.route('/upload', methods=['GET', 'POST'])
def upload():
if flask.request.method == 'POST':
Expand Down

0 comments on commit 5defef2

Please sign in to comment.