After this lesson, you will be able to:
Web development is a huge field. Where should you go next?
There are a few options to explore:
With one of those, you can also explore...
Configuring the part of the website people see.
Why?
GA has some classes! (Shameless self plug).
For your own study:
Start building up a portfolio of projects.
Once you're comfortable:
Handle the server side:
Why?
GA has some classes! (Another shameless self plug).
For your own study:
Start a portfolio (preferably on GitHub or another version control system).
Once you're comfortable:
Make a Beautiful Website
All this Python coding is a bit much for me, but I like websites.
Which should I look into?
Which do you think?
Make a Beautiful Website
All this Python coding is a bit much for me, but I like websites.
Which should I look into?
Not really a path!
Look into integrating these with Flask:
- Bootstrap
- SQLAlchemy/PyMongo
Front-end or Flask? This slide's for you.
Like awesome looking websites?
Don't like typing out HTML and CSS?
Bootstrap is for you!
Boostrap is great for:
Get it:
pip install Flask-Bootstrapgit clone https://github.com/mbr/flask-bootstrap.gitcd into the flask-bootstrap directory.pip install -r sample_app/requirements.txt to install the required packagesRun it:
flask --app=sample_app dev
Read the docs: https://getbootstrap.com/docs/3.3/getting-started/
Back-end or Flask? This slide's for you.
We can't always connect to a list!
SQL is the language for working with databases. Knowing a database is also crucial! Popular databases include:
Some Python libraries to look into:
- SQLAlchemy
- PyMongo
This slide's long! It's for your later reference.
Flask and Databases?
pip install Flask-SqlAlchemy
pip install Flask-PyMongo
Back-end database with no Flask?
python -m pip install pymongo
Either way, you need a database. Install MongoDB:
brew updatebrew install mongodbbrew install mongodb --develStart your MongoDB instance:
mkdir -p /data/db
sudo mkdir -p /data/db
mongod
Then, add some data to your database. Save the below to a python file and then try making GET and POST requests!
from flask import Flask, jsonify, request
from flask_pymongo import PyMongo
app = Flask(__name__)
app.config['MONGO_DBNAME'] = 'burritodb'
app.config['MONGO_URI'] = 'mongodb://localhost:27017/burritodb'
mongo = PyMongo(app)
@app.route('/burrito', methods=['GET'])
def get_all_burritos():
burrito = mongo.db.burritos
output = []
for s in burrito.find():
output.append({'ingredient' : s['ingredient'], 'burrito_necessity' : s['burrito_necessity']})
return jsonify({'result' : output})
@app.route('/burrito/', methods=['GET'])
def get_one_burrito(ingredient):
burrito = mongo.db.burritos
s = burrito.find_one({'ingredient' : ingredient})
if s:
output = {'ingredient' : s['ingredient'], 'burrito_necessity' : s['burrito_necessity']}
else:
output = "No such ingredient"
return jsonify({'result' : output})
@app.route('/burrito', methods=['POST'])
def add_burrito():
burrito = mongo.db.burritos
ingredient = request.json['ingredient']
burrito_necessity = request.json['burrito_necessity']
burrito_id = burrito.insert({'ingredient': ingredient, 'burrito_necessity': burrito_necessity})
new_burrito = burrito.find_one({'_id': burrito_id })
output = {'ingredient' : new_burrito['ingredient'], 'burrito_necessity' : new_burrito['burrito_necessity']}
return jsonify({'result' : output})
if __name__ == '__main__':
app.run(debug=True)
Make a Beautiful Database
All this Python coding is #goals.
Which should I look into?
Which do you think?
Make a Beautiful Database
All this Python coding is #goals.
Which should I look into?
Make an awesome Flask based website
I really liked all the above and am right at home between front end and back end with Flask.
Which should I look into?
Which do you think?
Make an awesome Flask based website
I really liked all the above and am right at home between front end and back end with Flask.
Which should I look into?
Flask isn't the only Python web framework.
There's also:
A more secure framework.
Highly scalable - think Disqus and Instagram.
Get started at djangoproject.com
Blogs don't need to change beyond the text!
Generates the HTML for you.
You just need Python code and text!
This is a really quick way to get a site up and running.
pip install pelican
Make a Blog
I want to build simple, static websites in less than 10 minutes and then work on content.
Which should I look into?
Which do you think?
Make a Blog
I want to build simple, static websites in less than 10 minutes and then work on content.
Which should I look into?
Make a website, but without all these libraries and extensions
I really the idea of this whole framework thing, but I wish there were only one, obvious way to do things.
Which should I look into?
Make a website, but without all these libraries and extensions
I really the idea of this whole framework thing, but I wish there were only one, obvious way to do things.
Which should I look into?
There's so much more!
Mozilla (they make Firefox) is an amazing resource.
There are a lot of ways to go!