Skip to content
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

Setting up flask file + html #10

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Setting up flask file + html #10

wants to merge 5 commits into from

Conversation

anhphung97
Copy link
Contributor

No description provided.

Copy link

@alanhdu alanhdu left a comment

Choose a reason for hiding this comment

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

Please fix indentation and style errors.

sudo apt-get install -y vim
sudo pip install flask

echo hello
Copy link

Choose a reason for hiding this comment

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

Stray echo

sudo apt-get update
sudo apt-get install -y python
sudo apt-get install -y python-pip
sudo apt-get install -y vim
Copy link

Choose a reason for hiding this comment

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

Can we combine these lines:

sudo apt-get install -y \
    python \
    python-pip \
    vim

(also, why do we need pip?)

sudo apt-get install -y python
sudo apt-get install -y python-pip
sudo apt-get install -y vim
sudo pip install flask
Copy link

Choose a reason for hiding this comment

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

Could we pull this out into a requirements.txt file and do pip install -r requirements.txt?

app.config["DEBUG"] = True
app.config['MONGODB_SETTINGS'] = { 'db' : 'users' }
app.config['SECRET_KEY'] = 'JJAM'
app.config['WTF_CSRF_ENABLED'] = True
Copy link

Choose a reason for hiding this comment

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

This is fine for now, but as we move to production we'll want to redo the config stuff.

courses = db.StringField()
def is_authenticated(self):
users = User.objects(name = self.name, password = self.password, courses = self.courses)
return len(users) != 0
Copy link

Choose a reason for hiding this comment

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

I'm not sure I follow the logic here.

If we have a User class, wouldn't it automatically be stored in the database (and have len(users) == 1)?

def is_anonymous(self):
return False
def get_id(self):
return self.name
Copy link

Choose a reason for hiding this comment

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

What are these functions for? Seem unnecessary to me.

def addcourses():
user = User.objects(name=current_user.name).first()
if request.method == 'POST':
user.courses = request.form['courses'].split("\n")
Copy link

Choose a reason for hiding this comment

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

I'm a little suspicious -- why are we passing in courses as a \n-delimited string? Can't we just post a list?

@anhphung97
Copy link
Contributor Author

fix schedule display, add by semester and track recommendation

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.

2 participants