Creating your first Flask app
Now that we have the proper tools installed, we're ready to create our first Flask app. To begin, create a directory somewhere convenient that will hold all of your Python projects. At the command prompt or terminal, navigate to your projects directory; mine is /home/charles/projects
, or ~/projects
for short on Unix-based systems.
$ mkdir ~/projects $ cd ~/projects
Now we will create a virtualenv
. The commands below will create a new directory named hello_flask
inside your projects folder that contains a complete, isolated Python environment.
$ virtualenv hello_flask New python executable in hello_flask/bin/python2. Also creating executable in hello_flask/bin/python Installing setuptools............done. Installing ...
Get Learning Flask Framework now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.