-
Notifications
You must be signed in to change notification settings - Fork 1
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
base: master
Are you sure you want to change the base?
Conversation
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.
Please fix indentation and style errors.
sudo apt-get install -y vim | ||
sudo pip install flask | ||
|
||
echo hello |
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.
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 |
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.
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 |
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.
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 |
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 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 |
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'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 |
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 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") |
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'm a little suspicious -- why are we passing in courses
as a \n
-delimited string? Can't we just post a list?
fix schedule display, add by semester and track recommendation |
No description provided.