Before initiating the programming process, you will need to install the required dependencies. Let's initiate the installation process by creating a virtual environment using virtual environment wrapper. It's one of the best practices to use a virtual environment while creating an application. The virtual environment wrapper is a tool which puts all the dependencies of the project in one place.
This practice will mitigate a lot of complications while dealing with different projects in your system. In our tutorial the installation and application development goes forward using Python version 2.7.
The following are the steps for setting up the environment:
pip
. You may have to use sudo
for administrative privileges:$ pip install virtualenvwrapper
WORKON_HOME
. So, set the environmental variable to ~/Envs
or anything of your choice.$ export WORKON_HOME=~/Envs
WORKON_HOME
directory using the following command if it doesn't exist on your local machine:$ mkdir -p $WORKON_HOME
virtualenvwrapper,
we need to activate the shell script virtualenvwrapper.sh
as shown in the following lines. On Ubuntu machines, we can find this script in the /usr/local/bin
location:$ source /usr/local/bin/virtualenvwrapper.sh
virtualenvwrapper
utilities at your terminal's startup.mkvirtualenv
command to create a new virtual environment for your project with the name survey
. Once the survey
environment is activated it gets displayed with the environment name in the closed braces before the shell prompt.$ mkvirtualenv survey New python executable in survey/bin/python Installing setuptools, pip...done. (survey) $
We are going to use Flask-SQLAlchemy in this project which is a Flask extension module that acts as an Object Relational Mapper (ORM) to interact with the database. We will also be using modules like requests
, httpretty
, beautifulsoup
in the development of our survey
application which we will be building in this tutorial.
Now install the following packages with your virtual environment activated:
(survey)~ $ pip install flask flask-sqlalchemy requests httpretty beautifulsoup4
3.148.113.229