-
Notifications
You must be signed in to change notification settings - Fork 45
Models in database: user, participant, hacknight #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
||
from flask_sqlalchemy import SQLAlchemy | ||
from os import urandom | ||
from models import db | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be two blank lines separating imports from the rest of the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
backend/migrations/__pycache__/env.cpython-35.pyc
- compilled file included in source
Shouldn't we add it to docker entrypoint and describe in readme?
@@ -0,0 +1,5 @@ | |||
Flask==1.0.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have requirements.txt
and backend/requirements.txt
. The first one should be removed as contains the same requirements as the later one and is outside backend
directory.
backend/models.py
Outdated
id = Column(Integer, autoincrement=True, primary_key=True) | ||
date = Column(String(20)) | ||
|
||
def get(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot figure out why we need this function?
backend/models.py
Outdated
""" | ||
__tablename__ = 'hacknight' | ||
id = Column(Integer, autoincrement=True, primary_key=True) | ||
date = Column(String(20)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
backend/models.py
Outdated
|
||
class Hacknight(db.Model): | ||
""" | ||
Hacknight model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring is a phrase ending in a period.
see: https://www.python.org/dev/peps/pep-0257/#one-line-docstrings
backend/models.py
Outdated
github = Column(String(200), default="") | ||
phone = Column(Integer, default=0 ) | ||
|
||
def get_id(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's this function for?
backend/app.py
Outdated
if __name__ == '__main__': | ||
app.run(host='0.0.0.0', debug=True) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what are these empty files here for?
@@ -0,0 +1,12 @@ | |||
from flask_script import Manager |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do we use this file? Don't see a change to docker entrypoint.
@@ -0,0 +1 @@ | |||
Generic single-database configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this file.
app.config["SQLALCHEMY_DATABASE_URI"] = SQLALCHEMY_DATABASE_URI | ||
app.config["SQLALCHEMY_POOL_RECYCLE"] = 299 | ||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False | ||
app.config['SECRET_KEY'] = urandom(24) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cannot be random (different) every time we run our server.
|
||
app = Flask(__name__) | ||
app.config["DEBUG"] = True | ||
SQLALCHEMY_DATABASE_URI = "postgresql://{username}:{password}@{hostname}:{port}/{databasename}".format( | ||
username="cfp_v3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import os
os.getenv('DB_USERNAME')
Models in database: user, participant, hacknight #18
No description provided.