Changes for Herbert

This commit is contained in:
Robbe Van Herck 2018-11-28 14:24:32 +01:00
parent ce1cce7d12
commit 7f8e6c4a04
5 changed files with 26 additions and 2 deletions

View file

@ -1,7 +1,7 @@
from app import db
endorsed = db.Table('endorses',
db.Column('user_id', db.String, db.ForeignKey('user.id'), primary_key=True),
db.Column('user_id', db.String(80), db.ForeignKey('user.id'), primary_key=True),
db.Column('achievement_id', db.Integer, db.ForeignKey('achievement.id'), primary_key=True)
)
@ -33,7 +33,7 @@ class User(db.Model):
class Achievement(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(128), nullable=False)
achieved_by = db.Column(db.Integer, db.ForeignKey("user.id"), nullable=False)
achieved_by = db.Column(db.String(80), db.ForeignKey("user.id"), nullable=False)
endorsed_by = db.relationship('User', secondary=endorsed, lazy='subquery', backref=db.backref('user', lazy=True))
@ -47,3 +47,4 @@ class Achievement(db.Model):
def __repr__(self):
return '<Achievement %r from %r>' % (self.name, self.achieved_by.name)

12
passenger_wsgi.py Normal file
View file

@ -0,0 +1,12 @@
#!/usr/bin/env python
import sys
import os
INTERP = os.path.expanduser("~/env/bin/python")
if sys.executable != INTERP:
os.execl(INTERP, INTERP, *sys.argv)
sys.path.append(os.getcwd())
from endorsement import app as application

View file

@ -9,7 +9,10 @@ idna==2.7
itsdangerous==0.24
Jinja2==2.10
MarkupSafe==1.0
mysql==0.0.2
mysqlclient==1.3.13
oauthlib==2.1.0
pkg-resources==0.0.0
pytz==2018.5
requests==2.19.1
requests-oauthlib==1.0.0

3
run_dev.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
FLASK_APP="endorsement.py" flask run

5
setup_db.py Executable file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env python3
from endorsement import db
db.create_all()