Skip to content

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

Closed
wants to merge 6 commits into from

Conversation

dagaaaaa
Copy link
Contributor

No description provided.


from flask_sqlalchemy import SQLAlchemy
from os import urandom
from models import db

Copy link
Contributor

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.

Copy link
Member

@magul magul left a 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
Copy link
Member

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.

id = Column(Integer, autoincrement=True, primary_key=True)
date = Column(String(20))

def get(self):
Copy link
Member

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?

"""
__tablename__ = 'hacknight'
id = Column(Integer, autoincrement=True, primary_key=True)
date = Column(String(20))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


class Hacknight(db.Model):
"""
Hacknight model
Copy link
Member

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

github = Column(String(200), default="")
phone = Column(Integer, default=0 )

def get_id(self):
Copy link
Member

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)

Copy link
Member

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
Copy link
Member

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.
Copy link
Member

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)
Copy link
Member

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",
Copy link
Member

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')

@dagaaaaa dagaaaaa closed this Dec 12, 2018
@dagaaaaa dagaaaaa deleted the database branch December 12, 2018 23:23
jacekkalbarczyk added a commit that referenced this pull request Jan 9, 2019
Models in database: user, participant, hacknight #18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants