Changes for Herbert
This commit is contained in:
parent
ce1cce7d12
commit
7f8e6c4a04
5 changed files with 26 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
||||||
from app import db
|
from app import db
|
||||||
|
|
||||||
endorsed = db.Table('endorses',
|
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)
|
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):
|
class Achievement(db.Model):
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
name = db.Column(db.String(128), nullable=False)
|
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))
|
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):
|
def __repr__(self):
|
||||||
return '<Achievement %r from %r>' % (self.name, self.achieved_by.name)
|
return '<Achievement %r from %r>' % (self.name, self.achieved_by.name)
|
||||||
|
|
||||||
|
|
12
passenger_wsgi.py
Normal file
12
passenger_wsgi.py
Normal 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
|
|
@ -9,7 +9,10 @@ idna==2.7
|
||||||
itsdangerous==0.24
|
itsdangerous==0.24
|
||||||
Jinja2==2.10
|
Jinja2==2.10
|
||||||
MarkupSafe==1.0
|
MarkupSafe==1.0
|
||||||
|
mysql==0.0.2
|
||||||
|
mysqlclient==1.3.13
|
||||||
oauthlib==2.1.0
|
oauthlib==2.1.0
|
||||||
|
pkg-resources==0.0.0
|
||||||
pytz==2018.5
|
pytz==2018.5
|
||||||
requests==2.19.1
|
requests==2.19.1
|
||||||
requests-oauthlib==1.0.0
|
requests-oauthlib==1.0.0
|
||||||
|
|
3
run_dev.sh
Executable file
3
run_dev.sh
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
FLASK_APP="endorsement.py" flask run
|
5
setup_db.py
Executable file
5
setup_db.py
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
from endorsement import db
|
||||||
|
|
||||||
|
db.create_all()
|
Loading…
Reference in a new issue